cpace icon indicating copy to clipboard operation
cpace copied to clipboard

Add test vectors to compare with the Go implementation.

Open hdevalence opened this issue 4 years ago • 2 comments

There should be test vectors that compare with @filosottile's implementation: https://github.com/FiloSottile/go-cpace-ristretto255

hdevalence avatar May 01 '20 01:05 hdevalence

Since there's an RNG involved, making test vectors will require controlling the RNG. This implementation takes a generic RNG, but the Go implementation doesn't, using rand.Rng internally.

A quick glance at cpace_test.go suggests that there's some kind of trickery involving defer to override the RNG for test purposes. Maybe something like that could be used for test vectors.

hdevalence avatar May 01 '20 01:05 hdevalence

Yep, TestTranscript contains a vector that should be possible for you to match.

https://github.com/FiloSottile/go-cpace-ristretto255/blob/6ff507385bae4bb06cb79b46494e394aa39aa47c/cpace_test.go#L47-L83

You can also make interop tests by using a recording of the Go side as a peer.

FiloSottile avatar May 02 '20 00:05 FiloSottile