Set-Membership Zero-Knowledge Proofs
So, let’s say there’s a number of winning tickets in a lottery of [654, 703, 991, 1011], can I prove I have a value which is in this set, and without giving away the number on my ticket? Well, one of my favouriate researchers — Jan Camenisch — created a method where we can prove that we have a value in a set of values, and without giving our value away [1][here]:
The paper was produced in 2008, and is often referred to as CSS08. With this, we provide a zero-knowledge proof that σ is included in a discrete set
Φ. This set is represented as 64-bit integers, and could thus be hashed version of string.
The code used is [here]:
package main
import (
"crypto/rand"
"fmt"
"os"
"strconv"
"strings"
"github.com/ing-bank/zkrp/ccs08"
"go.dedis.ch/kyber/v3/pairing/bn256"
)
func StringToIntArray(A string) []int64 {
strs := strings.Split(A, " ")
ary := make([]int64, len(strs))
for i := range ary {
v, _ := strconv.Atoi(strs[i])
ary[i] = int64(v)
}
return ary
}
func main() {
tofind := 6
set := "1 2 3 4 5"
argCount := len(os.Args[1:])
if argCount > 0 {
tofind, _ = strconv.Atoi(os.Args[1])
}
if argCount > 1 {
set =…