BlockstreamResearch / codex32

A paper computer for Shamir's Secret Sharing over the Bech32 alphabet.
80 stars 23 forks source link

Add basic test vectors #34

Closed robot-dreams closed 2 years ago

apoelstra commented 2 years ago

Thanks! These look great, but I think we want to include the HRP everywhere, because in particular we use MS for 128-bit secrets but I think MN for 256-bit ones. (Is that right @roconnor-blockstream ?)

apoelstra commented 2 years ago

I guess we should also decide on a hrp for 512 bit secrets..

roconnor-blockstream commented 2 years ago

HRP will be the same. It will just contain two codewords.

roconnor-blockstream commented 2 years ago

One last request: Can you lowercase most, but not all, of the examples? Lowercase is canonical. We use upper case in the volvelles because upper case letters are more clear for printing.

robot-dreams commented 2 years ago

Yeah good idea, kept Test Vector 2 as uppercase since it's the most likely volvelle use case.

apoelstra commented 2 years ago

Looks great to me -- though I haven't yet verified the vectors.

robot-dreams commented 2 years ago

@apoelstra Thanks! You can verify them by checking / running this script and comparing the diffs: https://gist.github.com/robot-dreams/436cc0ff7f244d96510389a8b0165ea7

(The script was NOT optimized for efficiency or readability, haha, but hopefully it gets the point across.)

roconnor-blockstream commented 2 years ago

I have now verified the test vectors with an independent implementation.