hdevalence / cpace

An EXPERIMENTAL implementation of the CPace PAKE, instantiated with the Ristretto255 group. In Rust
17 stars 2 forks source link

Add test vectors to compare with the Go implementation. #1

Open hdevalence opened 4 years ago

hdevalence commented 4 years ago

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

hdevalence commented 4 years ago

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.

FiloSottile commented 4 years ago

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.