RSA Accumulators And Proving Knowledge
Published in
2 min readJan 7, 2022
An accumulator allows Bob to add values onto a fixed-length digest, and to provide proof of the values added, without revealing them within the accumulated value. In this case, we will use a basic RSA method to make commitments to data elements, and then create proofs that these elements exist within the commitment [1]. So, here’s a basic method of proving knowledge of something, without revealing other things:
The outline code is [here]:
package mainimport (
"crypto/rand"
"fmt"
"math/big"
"os"
"unsafe" "golang.org/x/crypto/sha3"
)func HashToPrime(data []byte) *big.Int {
h := sha3.NewShake256()
h.Write(data)
p, err := rand.Prime(h, 256)
if err != nil {
panic(err)
}
return p
}func main() { P1 := "hello"
P2 := "goodbye"
P3 := "test"
P4 := "yellow" argCount := len(os.Args[1:]) if argCount > 0 {
P1 = os.Args[1]
}
if argCount > 1 {
P2 = os.Args[2]
}
if argCount > 2 {
P3 = os.Args[3]
}
if argCount > 3 {
P4 = os.Args[4]
} p, _ :=…