Commit Graph

301 Commits

Author SHA1 Message Date
Daira Hopwood 45a21dc05c Rust identifiers must be lowercase.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-31 19:18:34 +01:00
Daira Hopwood 2a6b7c7733 Don't recompute len(tweak).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-31 19:14:38 +01:00
Daira Hopwood 7c392675b8 Add ZIP 32 implementation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood c67d4b1fc2 Add FF1 implementation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood f024c7dd8f Extract some SpendingKey methods into mixins that will be used by ZIP 32 classes.
Also use hex, not octal byte constants.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood 61f7f70e7a Add diversify_hash function rather than repeating the personalization.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood 5c00456ae5 Add more conversion utility functions.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood bfcc98b327 Add a '-t json' option that gives JSON output without reversing 32-byte test vectors.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood 5394ee1a15 Style nit: don't use list comprehensions for side-effecting code.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood 3dfe532bac Support printing test vectors of Option type (needed for diversifiers).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
Daira Hopwood c8036959ad Add assertions that we are running under Python 3.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-25 01:16:22 +01:00
str4d cbdb16ed55
Merge pull request #6 from daira/daira-misc-improvements
Additions to .gitignore; rename CRS to URS; add test vectors for Pedersen generators
2018-07-25 00:44:25 +02:00
Daira Hopwood 013efd4c87 Add test vectors for the first 4 Pedersen hash generators.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-03 15:04:41 +01:00
Daira Hopwood 4806d8494b Rename CRS to URS, matching version beta-21 of Sapling spec.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-03 15:04:41 +01:00
Daira Hopwood 3aa38fb3c9 Avoid shadowing a variable name.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-03 15:04:41 +01:00
Daira Hopwood 64664bc614 Additions to .gitignore.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-07-03 15:04:41 +01:00
str4d 0e854b1ddd
Merge pull request #4 from str4d/json-output
Implement Zcash test vector output format
2018-06-13 23:09:49 +12:00
Jack Grigg dd66ed8fec
Explicitly make the JSON output Bitcoin-flavoured (32-byte values reversed)
Also renames the 'json' output type to 'zcash' to make it more obvious.
2018-06-13 11:48:17 +12:00
Jack Grigg 145fe37af5
Implement JSON output 2018-06-05 20:36:37 +12:00
Jack Grigg 68263af2b5
Extract sapling_key_components Rust rendering 2018-06-05 17:30:16 +12:00
Jack Grigg d5d7d70a65
Extract sapling_signatures Rust rendering 2018-06-05 17:12:24 +12:00
Jack Grigg 9f4a41dcf3
Extract sapling_generators Rust rendering 2018-06-05 16:46:08 +12:00
Jack Grigg 7e37b8cc24
Move chunk() into tv_output module 2018-06-05 16:10:43 +12:00
str4d 9edd16e17a
Merge pull request #2 from daira/refactor-field-errors
Refactor error handling
2018-06-05 16:06:47 +12:00
str4d 41d250ed0c
Merge pull request #1 from str4d/to_scalar
Implement ToScalar from spec, and small refactor to match spec more closely
2018-06-05 09:05:46 +12:00
Daira Hopwood 74aeee659b Use a ValueError exception to represent out-of-range field element representations.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2018-06-04 14:36:37 +01:00
Jack Grigg 739ec65c52
Implement ToScalar from spec, and small refactor to match spec more closely
Test vectors from sapling_key_components.py and sapling_signatures.py are not
altered by this commit.
2018-06-05 00:33:50 +12:00
Jack Grigg 1fbb3b2036 Alter definition of layer in merkle_crh to match the spec 2018-05-19 08:08:38 +12:00
Jack Grigg c795bb6ef7 Add comments to test vector output linking to source 2018-05-19 07:48:49 +12:00
Jack Grigg 7aebe58a58 Add note nullifiers to key component test vectors 2018-05-19 07:47:22 +12:00
Jack Grigg 51206901cc Add note commitments to key component test vectors 2018-05-19 07:19:09 +12:00
Jack Grigg ef17e5bc26 Reject encoded points with v not in the field 2018-05-19 06:30:19 +12:00
Jack Grigg d32ed1a957 Add test of merkle_crh 2018-05-19 06:29:39 +12:00
Jack Grigg 2641abb3be Add tests of field arithmetic 2018-05-19 06:27:33 +12:00
Jack Grigg 2d8f84e032 Fix RedJubjub test vector output 2018-05-18 20:09:39 +12:00
Jack Grigg fb07e639b9 Generate test vectors for Sapling generators 2018-05-18 18:28:12 +12:00
Jack Grigg 6786564447 Implement LEBS2OSP and LEOS2BSP 2018-05-18 18:06:38 +12:00
Jack Grigg 9df19eb154 pylint 2018-05-18 18:01:08 +12:00
Jack Grigg ce7c7cfb39 Fix compilation bugs in Pedersen hash 2018-05-18 18:01:08 +12:00
Jack Grigg 2f152758ba Implement RedJubjub 2018-05-18 18:01:05 +12:00
Jack Grigg 6d12cb9a74 Extract LEOS2IP and I2LEOSP functions 2018-05-18 15:28:36 +12:00
Jack Grigg 64863e135b Specify dependencies 2018-05-18 13:18:52 +12:00
Jack Grigg f91cb9e5b4 Implement NoteCommit 2018-05-18 13:18:52 +12:00
Jack Grigg 3e2b2ab8f8 Implement MerkleCRH 2018-05-18 13:18:50 +12:00
Jack Grigg 929b36ccfd Implement Pedersen hashes and commitments 2018-05-18 13:18:47 +12:00
Jack Grigg 146c821fc9 Add remaining Sapling generators 2018-05-18 12:47:05 +12:00
Jack Grigg edaf23fdf8 Change variable names to match the spec 2018-05-18 12:45:19 +12:00
Jack Grigg 95f483fd3d Refactor into modules 2018-05-18 11:57:11 +12:00
Jack Grigg c0d4ff2fd2 Add test vector generator for Sapling key components 2018-05-18 07:21:42 +12:00
Jack Grigg 6cefcd3c94 Ignore virtualenv directory 2018-05-18 07:21:23 +12:00