|
|
|
@ -27,6 +27,8 @@ fn key_components() {
|
|
|
|
|
note_v: u64, |
|
|
|
|
note_r: [u8; 32], |
|
|
|
|
note_cm: [u8; 32], |
|
|
|
|
note_pos: u64, |
|
|
|
|
note_nf: [u8; 32], |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/sapling_key_components.py
|
|
|
|
@ -86,6 +88,12 @@ fn key_components() {
|
|
|
|
|
0x18, 0x50, 0xc9, 0xfe, 0xd4, 0x4f, 0xce, 0x08, 0x06, 0x27, 0x8f, 0x08, 0x3e, 0xf2, |
|
|
|
|
0xdd, 0x07, 0x64, 0x39, |
|
|
|
|
], |
|
|
|
|
note_pos: 0, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x44, 0xfa, 0xd6, 0x56, 0x4f, 0xfd, 0xec, 0x9f, 0xa1, 0x9c, 0x43, 0xa2, 0x8f, 0x86, |
|
|
|
|
0x1d, 0x5e, 0xbf, 0x60, 0x23, 0x46, 0x00, 0x7d, 0xe7, 0x62, 0x67, 0xd9, 0x75, 0x27, |
|
|
|
|
0x47, 0xab, 0x40, 0x63, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -142,6 +150,12 @@ fn key_components() {
|
|
|
|
|
0x89, 0xe1, 0x0e, 0x26, 0x6b, 0xcf, 0xa3, 0x1c, 0x31, 0xb2, 0x9a, 0x53, 0xae, 0x72, |
|
|
|
|
0xca, 0xd4, 0x69, 0x50, |
|
|
|
|
], |
|
|
|
|
note_pos: 763714296, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x67, 0x9e, 0xb0, 0xc3, 0xa7, 0x57, 0xe2, 0xae, 0x83, 0xcd, 0xb4, 0x2a, 0x1a, 0xb2, |
|
|
|
|
0x59, 0xd7, 0x83, 0x88, 0x31, 0x54, 0x19, 0xad, 0xc7, 0x1d, 0x2e, 0x37, 0x63, 0x17, |
|
|
|
|
0x4c, 0x2e, 0x9d, 0x93, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -198,6 +212,12 @@ fn key_components() {
|
|
|
|
|
0xb7, 0x40, 0x82, 0x96, 0x66, 0x17, 0x70, 0xb1, 0x01, 0xb0, 0xaa, 0x87, 0x83, 0x9f, |
|
|
|
|
0x4e, 0x55, 0xf1, 0x51, |
|
|
|
|
], |
|
|
|
|
note_pos: 1527428592, |
|
|
|
|
note_nf: [ |
|
|
|
|
0xe9, 0x8f, 0x6a, 0x8f, 0x34, 0xff, 0x49, 0x80, 0x59, 0xb3, 0xc7, 0x31, 0xb9, 0x1f, |
|
|
|
|
0x45, 0x11, 0x08, 0xc4, 0x95, 0x4d, 0x91, 0x94, 0x84, 0x36, 0x1c, 0xf9, 0xb4, 0x8f, |
|
|
|
|
0x59, 0xae, 0x1d, 0x14, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -254,6 +274,12 @@ fn key_components() {
|
|
|
|
|
0xbd, 0x10, 0x5d, 0x88, 0x39, 0x21, 0x2e, 0x0d, 0x16, 0x44, 0xb9, 0xd5, 0x5c, 0xaa, |
|
|
|
|
0x60, 0xd1, 0x9b, 0x6c, |
|
|
|
|
], |
|
|
|
|
note_pos: 2291142888, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x55, 0x47, 0xaa, 0x12, 0xff, 0x80, 0xa6, 0xb3, 0x30, 0x4e, 0x3b, 0x05, 0x86, 0x56, |
|
|
|
|
0x47, 0x2a, 0xbd, 0x2c, 0x81, 0x83, 0xb5, 0x9d, 0x07, 0x37, 0xb9, 0x3c, 0xee, 0x75, |
|
|
|
|
0x8b, 0xec, 0x47, 0xa1, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -310,6 +336,12 @@ fn key_components() {
|
|
|
|
|
0xcf, 0x1e, 0x67, 0x15, 0xbf, 0xe7, 0x0b, 0x63, 0x2d, 0x04, 0x4b, 0x26, 0xfb, 0x2b, |
|
|
|
|
0xc7, 0x1b, 0x7f, 0x36, |
|
|
|
|
], |
|
|
|
|
note_pos: 3054857184, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x8a, 0x9a, 0xbd, 0xa3, 0xd4, 0xef, 0x85, 0xca, 0xf2, 0x2b, 0xfa, 0xf2, 0xc4, 0x8f, |
|
|
|
|
0x62, 0x38, 0x2a, 0x73, 0xa1, 0x62, 0x4e, 0xb8, 0xeb, 0x2b, 0xd0, 0x0d, 0x27, 0x03, |
|
|
|
|
0x01, 0xbf, 0x3d, 0x13, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -366,6 +398,12 @@ fn key_components() {
|
|
|
|
|
0x1d, 0x74, 0xc5, 0xbc, 0xf2, 0xe1, 0xef, 0x95, 0x66, 0x90, 0x44, 0x73, 0x01, 0x69, |
|
|
|
|
0xde, 0x1a, 0x5b, 0x4c, |
|
|
|
|
], |
|
|
|
|
note_pos: 3818571480, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x33, 0x2a, 0xd9, 0x9e, 0xb9, 0xe9, 0x77, 0xeb, 0x62, 0x7a, 0x12, 0x2d, 0xbf, 0xb2, |
|
|
|
|
0xf2, 0x5f, 0xe5, 0x88, 0xe5, 0x97, 0x75, 0x3e, 0xc5, 0x58, 0x0f, 0xf2, 0xbe, 0x20, |
|
|
|
|
0xb6, 0xc9, 0xa7, 0xe1, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -422,6 +460,12 @@ fn key_components() {
|
|
|
|
|
0x90, 0xb6, 0xe0, 0xf2, 0xf4, 0xbf, 0x4e, 0xc4, 0xa0, 0xdb, 0x5b, 0xbc, 0xcb, 0x5b, |
|
|
|
|
0x78, 0x3a, 0x1e, 0x55, |
|
|
|
|
], |
|
|
|
|
note_pos: 287318480, |
|
|
|
|
note_nf: [ |
|
|
|
|
0xfc, 0x74, 0xcd, 0x0e, 0x4b, 0xe0, 0x49, 0x57, 0xb1, 0x96, 0xcf, 0x87, 0x34, 0xae, |
|
|
|
|
0x99, 0x23, 0x96, 0xaf, 0x4c, 0xfa, 0x8f, 0xec, 0xbb, 0x86, 0xf9, 0x61, 0xe6, 0xb4, |
|
|
|
|
0x07, 0xd5, 0x1e, 0x11, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -478,6 +522,12 @@ fn key_components() {
|
|
|
|
|
0x60, 0xa0, 0x06, 0xf8, 0x2b, 0xb7, 0xad, 0xcd, 0x75, 0x22, 0x3f, 0xa8, 0x59, 0x36, |
|
|
|
|
0xf7, 0x8c, 0x2b, 0x23, |
|
|
|
|
], |
|
|
|
|
note_pos: 1051032776, |
|
|
|
|
note_nf: [ |
|
|
|
|
0xd2, 0xe8, 0x87, 0xbd, 0x85, 0x4a, 0x80, 0x2b, 0xce, 0x85, 0x70, 0x53, 0x02, 0x0f, |
|
|
|
|
0x5d, 0x3e, 0x7c, 0x8a, 0xe5, 0x26, 0x7c, 0x5b, 0x65, 0x83, 0xb3, 0xd2, 0x12, 0xcc, |
|
|
|
|
0x8b, 0xb6, 0x98, 0x90, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -534,6 +584,12 @@ fn key_components() {
|
|
|
|
|
0x23, 0x36, 0xc2, 0xa0, 0x5a, 0x08, 0x03, 0x23, 0x9b, 0x5b, 0x88, 0xfd, 0x92, 0x07, |
|
|
|
|
0x8f, 0xea, 0x4d, 0x04, |
|
|
|
|
], |
|
|
|
|
note_pos: 1814747072, |
|
|
|
|
note_nf: [ |
|
|
|
|
0xa8, 0x2f, 0x17, 0x50, 0xcc, 0x5b, 0x2b, 0xee, 0x64, 0x9a, 0x36, 0x5c, 0x04, 0x20, |
|
|
|
|
0xed, 0x87, 0x07, 0x5b, 0x88, 0x71, 0xfd, 0xa4, 0xa7, 0xf5, 0x84, 0x0d, 0x6b, 0xbe, |
|
|
|
|
0xb1, 0x7c, 0xd6, 0x20, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
TestVector { |
|
|
|
|
sk: [ |
|
|
|
@ -590,6 +646,12 @@ fn key_components() {
|
|
|
|
|
0x64, 0x41, 0x9b, 0x0e, 0x55, 0x0a, 0xbb, 0xcb, 0x8e, 0x2b, 0xcb, 0xda, 0x8b, 0x63, |
|
|
|
|
0xe4, 0x1d, 0xeb, 0x37, |
|
|
|
|
], |
|
|
|
|
note_pos: 2578461368, |
|
|
|
|
note_nf: [ |
|
|
|
|
0x65, 0x36, 0x74, 0x87, 0x3b, 0x3c, 0x67, 0x0c, 0x58, 0x85, 0x84, 0x73, 0xe7, 0xfe, |
|
|
|
|
0x72, 0x19, 0x72, 0xfb, 0x96, 0xe2, 0x15, 0xb8, 0x73, 0x77, 0xa1, 0x7c, 0xa3, 0x71, |
|
|
|
|
0x0d, 0x93, 0xc9, 0xe9, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
@ -662,5 +724,7 @@ fn key_components() {
|
|
|
|
|
note.cm(&JUBJUB).into_repr().write_le(&mut vec).unwrap(); |
|
|
|
|
assert_eq!(&vec, &tv.note_cm); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
assert_eq!(note.nf(&fvk, tv.note_pos, &JUBJUB), tv.note_nf); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|