Add test vectors for unified IVKs.

Co-authored-by: Ying Tong Lai <yingtong@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
therealyingtong 2022-01-13 18:06:30 +08:00 committed by Daira Hopwood
parent 5eb385fc3a
commit e193d8775a
3 changed files with 278 additions and 1 deletions

View File

@ -25,7 +25,8 @@ tv_external_scripts=(
orchard_map_to_curve
orchard_poseidon_hash
unified_address
unified_full_viewing_keys)
unified_full_viewing_keys
unified_incoming_viewing_keys)
for generator in "${tv_scripts[@]}"
do

View File

@ -0,0 +1,150 @@
struct TestVector {
t_key_bytes: Option<[u8; 65]>,
sapling_ivk_bytes: Option<[u8; 64]>,
orchard_ivk_bytes: Option<[u8; 64]>,
unknown_ivk_typecode: u32,
unknown_ivk_bytes: Option<Vec<u8>>,
unified_ivk: Vec<u8>,
};
// From https://github.com/zcash-hackworks/zcash-test-vectors/blob/master/unified_incoming_viewing_keys.py
let test_vectors = vec![
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: Some([
0x27, 0xa0, 0xd4, 0xc0, 0xbc, 0xa9, 0x09, 0x84, 0xcd, 0xf3, 0x9f, 0xb4, 0xcc, 0x61, 0xce, 0xee, 0x78, 0xdd, 0xaa, 0x2a, 0x45, 0xaf, 0x87, 0x1f, 0x49, 0xf0, 0x4e, 0x98, 0xb0, 0x2f, 0xb1, 0x6b, 0x90, 0x3f, 0x6d, 0x4b, 0xbf, 0x93, 0x7e, 0xc4, 0x0f, 0x42, 0x82, 0x07, 0xc7, 0xc5, 0xe8, 0x9e, 0xe9, 0xd3, 0x0c, 0x81, 0x09, 0xed, 0x8b, 0x6d, 0xcb, 0xa0, 0x48, 0x27, 0xf7, 0x61, 0x3e, 0x00
]),
orchard_ivk_bytes: None,
unknown_ivk_typecode: 65535,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x34, 0x64, 0x6d, 0x75, 0x7a, 0x6d, 0x34, 0x6d, 0x32, 0x36, 0x6a, 0x74, 0x35, 0x6e, 0x36, 0x38, 0x66, 0x34, 0x38, 0x70, 0x32, 0x32, 0x66, 0x38, 0x73, 0x7a, 0x63, 0x6c, 0x75, 0x7a, 0x63, 0x7a, 0x6d, 0x30, 0x75, 0x6d, 0x35, 0x76, 0x76, 0x74, 0x65, 0x67, 0x37, 0x30, 0x72, 0x7a, 0x35, 0x74, 0x77, 0x35, 0x6c, 0x39, 0x65, 0x79, 0x70, 0x73, 0x77, 0x66, 0x35, 0x35, 0x6b, 0x72, 0x6c, 0x32, 0x38, 0x7a, 0x68, 0x7a, 0x65, 0x39, 0x7a, 0x70, 0x36, 0x73, 0x39, 0x6c, 0x37, 0x6d, 0x74, 0x33, 0x75, 0x6a, 0x66, 0x37, 0x6c, 0x76, 0x34, 0x64, 0x71, 0x71, 0x76, 0x30, 0x74, 0x36, 0x34, 0x36, 0x75, 0x38, 0x66, 0x6b, 0x74, 0x7a, 0x36, 0x7a, 0x70, 0x39, 0x78, 0x70, 0x6b, 0x6a, 0x67, 0x33, 0x35, 0x7a, 0x37, 0x61, 0x36, 0x38, 0x61, 0x61, 0x79, 0x74, 0x38, 0x78, 0x65, 0x71, 0x39, 0x6b, 0x6e, 0x32, 0x61, 0x73, 0x66, 0x72, 0x73, 0x64, 0x78, 0x6c
],
},
TestVector {
t_key_bytes: Some([
0x18, 0xd9, 0x61, 0x4f, 0xc8, 0x20, 0x90, 0x5d, 0x04, 0x2b, 0xb1, 0xef, 0x9c, 0xa3, 0xf2, 0x49, 0x88, 0xc7, 0xb3, 0x53, 0x42, 0x01, 0xcf, 0xb1, 0xcd, 0x8d, 0xbf, 0x69, 0xb8, 0x25, 0x0c, 0x18, 0x02, 0x82, 0x03, 0x46, 0xfc, 0xec, 0x8e, 0xa1, 0x27, 0x6d, 0xb2, 0xe6, 0x15, 0xb8, 0xce, 0xd2, 0xfe, 0x4c, 0xf7, 0x46, 0x8c, 0x1e, 0xf4, 0x53, 0x14, 0x61, 0x95, 0xb4, 0xd7, 0xbc, 0x13, 0xa4, 0xdc
]),
sapling_ivk_bytes: Some([
0xd1, 0x87, 0xf3, 0x2c, 0xe0, 0x2f, 0x8c, 0xa3, 0x57, 0xb5, 0x75, 0xe7, 0x05, 0xcd, 0xa7, 0xef, 0x8e, 0x1c, 0x68, 0xb9, 0x11, 0x03, 0x81, 0xbd, 0x39, 0x58, 0xe0, 0x65, 0x9a, 0x08, 0x42, 0x05, 0x40, 0x63, 0x51, 0xf7, 0x77, 0xaf, 0x57, 0xd8, 0x6c, 0xba, 0x02, 0x2c, 0x13, 0x5f, 0xad, 0xfa, 0x65, 0xbe, 0x02, 0x1b, 0xca, 0x36, 0x47, 0x92, 0xcf, 0xd4, 0x51, 0xef, 0xe2, 0xbc, 0x9d, 0x00
]),
orchard_ivk_bytes: None,
unknown_ivk_typecode: 65530,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x39, 0x61, 0x67, 0x6d, 0x65, 0x74, 0x78, 0x36, 0x77, 0x32, 0x65, 0x38, 0x70, 0x78, 0x61, 0x34, 0x7a, 0x77, 0x6b, 0x71, 0x77, 0x6e, 0x67, 0x77, 0x30, 0x67, 0x67, 0x39, 0x65, 0x35, 0x68, 0x63, 0x30, 0x68, 0x34, 0x66, 0x78, 0x6c, 0x39, 0x34, 0x76, 0x6b, 0x73, 0x34, 0x61, 0x76, 0x34, 0x77, 0x61, 0x34, 0x6a, 0x7a, 0x6e, 0x6c, 0x37, 0x6e, 0x30, 0x6b, 0x72, 0x77, 0x61, 0x76, 0x65, 0x73, 0x6e, 0x71, 0x36, 0x33, 0x6a, 0x68, 0x73, 0x72, 0x34, 0x37, 0x61, 0x36, 0x79, 0x78, 0x6b, 0x74, 0x38, 0x34, 0x63, 0x66, 0x6e, 0x36, 0x6e, 0x6e, 0x30, 0x78, 0x65, 0x6b, 0x79, 0x73, 0x65, 0x73, 0x6d, 0x64, 0x79, 0x76, 0x6d, 0x30, 0x7a, 0x39, 0x64, 0x38, 0x38, 0x73, 0x6b, 0x72, 0x65, 0x64, 0x6b, 0x74, 0x36, 0x34, 0x79, 0x37, 0x71, 0x79, 0x6a, 0x79, 0x7a, 0x33, 0x71, 0x67, 0x7a, 0x7a, 0x63, 0x36, 0x6c, 0x79, 0x66, 0x6d, 0x6a, 0x71, 0x6e, 0x65, 0x65, 0x6b, 0x6c, 0x67, 0x6e, 0x70, 0x77, 0x7a, 0x38, 0x6a, 0x74, 0x70, 0x6d, 0x68, 0x6d, 0x6a, 0x6d, 0x75, 0x73, 0x6e, 0x30, 0x6e, 0x65, 0x36, 0x6a, 0x6c, 0x78, 0x71, 0x63, 0x70, 0x6c, 0x61, 0x66, 0x35, 0x6c, 0x34, 0x63, 0x76, 0x6d, 0x75, 0x68, 0x64, 0x79, 0x79, 0x71, 0x63, 0x65, 0x64, 0x78, 0x7a, 0x65, 0x63, 0x35, 0x74, 0x66, 0x64, 0x77, 0x39, 0x78, 0x32, 0x6b, 0x77, 0x68, 0x73, 0x67, 0x70, 0x37, 0x65, 0x6d, 0x7a, 0x79, 0x34, 0x35, 0x64, 0x63, 0x36, 0x76, 0x66, 0x65, 0x6e, 0x66, 0x64, 0x36, 0x73, 0x74, 0x75, 0x71, 0x6b, 0x61, 0x64, 0x78, 0x39, 0x32, 0x65, 0x77, 0x7a, 0x36, 0x63, 0x6c, 0x64, 0x67, 0x66, 0x30, 0x70, 0x39, 0x6d, 0x35
],
},
TestVector {
t_key_bytes: Some([
0x25, 0x94, 0x6f, 0x62, 0xc2, 0xfa, 0x7b, 0x2f, 0xec, 0xbc, 0xb6, 0x4b, 0x69, 0x68, 0x91, 0x2a, 0x63, 0x81, 0xce, 0x3d, 0xc1, 0x66, 0xd5, 0x6a, 0x1d, 0x62, 0xf5, 0xa8, 0xd7, 0x55, 0x1d, 0xb5, 0x03, 0x06, 0x2c, 0xaf, 0x06, 0xc8, 0x96, 0x38, 0x77, 0x4b, 0x69, 0x8a, 0xaa, 0xfc, 0x8c, 0x83, 0x4f, 0xb2, 0x69, 0x6f, 0x70, 0xc3, 0xcd, 0xc7, 0x0f, 0x45, 0x28, 0xf4, 0xdd, 0xae, 0x53, 0xf9, 0xe1
]),
sapling_ivk_bytes: Some([
0x17, 0xb3, 0xbc, 0x77, 0xf6, 0x2f, 0x35, 0xbd, 0x42, 0x05, 0xe6, 0xf6, 0x82, 0xb1, 0xf9, 0xe8, 0x24, 0xec, 0xea, 0x53, 0xe2, 0x71, 0xb8, 0x0f, 0xf6, 0xbc, 0x79, 0xef, 0x68, 0xa2, 0x0a, 0xb5, 0x3e, 0xef, 0x52, 0x30, 0x36, 0x7a, 0x6b, 0xcf, 0x61, 0x41, 0x95, 0x94, 0xf3, 0x3e, 0xef, 0xcf, 0xb9, 0x36, 0xd5, 0x2b, 0xd8, 0xda, 0x9c, 0xec, 0xf1, 0x30, 0xd3, 0xa8, 0x87, 0xdf, 0x47, 0x07
]),
orchard_ivk_bytes: Some([
0x0b, 0x2e, 0x1e, 0x50, 0x6b, 0x54, 0xb8, 0xea, 0x77, 0x02, 0xb3, 0x18, 0x3b, 0xa8, 0xf2, 0xa3, 0x42, 0xb6, 0xa0, 0x28, 0x45, 0xa0, 0x8f, 0x65, 0xeb, 0x6e, 0x1b, 0x68, 0xac, 0xd3, 0xd0, 0xf4, 0x97, 0x55, 0xae, 0x28, 0xf9, 0x12, 0xbc, 0x62, 0x12, 0x82, 0x50, 0x92, 0xc3, 0x48, 0xe6, 0x5b, 0x98, 0x9d, 0x5f, 0xcc, 0x94, 0x0f, 0xf8, 0xdb, 0x49, 0x46, 0x6e, 0xdb, 0x8c, 0xb6, 0x8d, 0x1b
]),
unknown_ivk_typecode: 65532,
unknown_ivk_bytes: Some(vec![
0x1a, 0x03, 0x55, 0x87, 0xd5, 0xfb, 0x1a, 0x38, 0xe0, 0x1d, 0x94, 0x90, 0x3d, 0x3c, 0x3e, 0x0a, 0xd3, 0x36, 0x0c, 0x1d, 0x37, 0x10, 0xac, 0xd2, 0x0b, 0x18, 0x3e, 0x31, 0xd4, 0x9f, 0x25, 0xc9, 0xa1, 0x38, 0xf4, 0x9b, 0x1a, 0x53, 0x7e, 0xdc, 0xf0, 0x4b, 0xe3, 0x4a, 0x98, 0x51, 0xa7, 0xaf, 0x9d, 0xb6, 0x99, 0x0e, 0xd8, 0x3d, 0xd6, 0x4a, 0xf3, 0x59, 0x7c, 0x04, 0x32, 0x3e, 0xa5, 0x1b, 0x00, 0x52, 0xad, 0x80, 0x84, 0xa8, 0xb9, 0xda, 0x94, 0x8d, 0x32, 0x0d, 0xad, 0xd6, 0x4f, 0x54, 0x31, 0xe6, 0x1d, 0xdf, 0x65, 0x8d, 0x24, 0xae, 0x67, 0xc2, 0x2c, 0x8d, 0x13, 0x09, 0x13, 0x1f, 0xc0, 0x0f, 0xe7, 0xf2, 0x35, 0x73, 0x42, 0x76, 0xd3, 0x8d, 0x47, 0xf1, 0xe1, 0x91, 0xe0, 0x0c, 0x7a, 0x1d, 0x48, 0xaf, 0x04, 0x68, 0x27, 0x59, 0x1e, 0x97, 0x33, 0xa9, 0x7f, 0xa6, 0xb6, 0x79, 0xf3, 0xdc, 0x60, 0x1d, 0x00, 0x82, 0x85, 0xed, 0xcb, 0xda, 0xe6, 0x9c, 0xe8, 0xfc, 0x1b, 0xe4, 0xaa, 0xc0, 0x0f, 0xf2, 0x71, 0x1e, 0xbd, 0x93, 0x1d, 0xe5, 0x18, 0x85, 0x68, 0x78, 0xf7, 0x34, 0x76
]),
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x30, 0x75, 0x66, 0x6e, 0x70, 0x35, 0x35, 0x32, 0x66, 0x63, 0x70, 0x79, 0x6b, 0x6d, 0x65, 0x65, 0x68, 0x34, 0x35, 0x6e, 0x35, 0x36, 0x65, 0x77, 0x77, 0x61, 0x6b, 0x6b, 0x35, 0x33, 0x77, 0x78, 0x68, 0x67, 0x76, 0x64, 0x76, 0x66, 0x34, 0x65, 0x38, 0x7a, 0x33, 0x6b, 0x30, 0x35, 0x39, 0x79, 0x72, 0x38, 0x74, 0x67, 0x35, 0x36, 0x74, 0x76, 0x6a, 0x74, 0x36, 0x6c, 0x67, 0x39, 0x33, 0x66, 0x67, 0x71, 0x74, 0x6d, 0x76, 0x34, 0x6d, 0x74, 0x6c, 0x63, 0x6e, 0x34, 0x32, 0x36, 0x63, 0x6a, 0x65, 0x6e, 0x7a, 0x37, 0x65, 0x7a, 0x30, 0x30, 0x73, 0x6c, 0x64, 0x70, 0x39, 0x39, 0x33, 0x67, 0x6c, 0x71, 0x34, 0x78, 0x37, 0x30, 0x61, 0x36, 0x61, 0x77, 0x76, 0x65, 0x72, 0x76, 0x37, 0x39, 0x32, 0x74, 0x79, 0x6d, 0x74, 0x6a, 0x71, 0x72, 0x77, 0x6c, 0x33, 0x39, 0x30, 0x68, 0x63, 0x77, 0x35, 0x35, 0x6a, 0x68, 0x32, 0x32, 0x30, 0x74, 0x77, 0x33, 0x70, 0x66, 0x38, 0x35, 0x65, 0x76, 0x64, 0x74, 0x63, 0x74, 0x6b, 0x61, 0x6b, 0x6b, 0x79, 0x6d, 0x38, 0x6b, 0x6c, 0x39, 0x30, 0x32, 0x6e, 0x67, 0x6d, 0x74, 0x34, 0x7a, 0x75, 0x78, 0x68, 0x33, 0x72, 0x7a, 0x66, 0x63, 0x79, 0x7a, 0x71, 0x6e, 0x33, 0x6a, 0x37, 0x67, 0x67, 0x6b, 0x77, 0x32, 0x6e, 0x30, 0x30, 0x39, 0x34, 0x70, 0x71, 0x77, 0x36, 0x30, 0x73, 0x72, 0x33, 0x6c, 0x33, 0x36, 0x74, 0x70, 0x75, 0x76, 0x67, 0x77, 0x71, 0x6d, 0x74, 0x38, 0x35, 0x75, 0x79, 0x6b, 0x72, 0x6c, 0x78, 0x61, 0x63, 0x34, 0x74, 0x79, 0x73, 0x34, 0x64, 0x78, 0x75, 0x77, 0x79, 0x6d, 0x70, 0x65, 0x6b, 0x37, 0x7a, 0x63, 0x6b, 0x32, 0x37, 0x68, 0x78, 0x6a, 0x76, 0x6c, 0x38, 0x77, 0x68, 0x75, 0x67, 0x74, 0x79, 0x33, 0x6c, 0x66, 0x75, 0x66, 0x63, 0x68, 0x6e, 0x70, 0x72, 0x64, 0x38, 0x66, 0x72, 0x37, 0x39, 0x61, 0x6a, 0x66, 0x6a, 0x75, 0x6d, 0x36, 0x37, 0x75, 0x71, 0x32, 0x67, 0x65, 0x79, 0x71, 0x34, 0x64, 0x33, 0x35, 0x64, 0x38, 0x34, 0x70, 0x38, 0x6e, 0x63, 0x30, 0x65, 0x35, 0x37, 0x6a, 0x6b, 0x76, 0x79, 0x35, 0x65, 0x38, 0x65, 0x30, 0x32, 0x35, 0x30, 0x6a, 0x38, 0x72, 0x6a, 0x6a, 0x6b, 0x32, 0x79, 0x6e, 0x32, 0x6b, 0x74, 0x68, 0x6a, 0x68, 0x39, 0x64, 0x34, 0x61, 0x77, 0x6b, 0x37, 0x6c, 0x32, 0x6b, 0x6a, 0x75, 0x6b, 0x7a, 0x74, 0x79, 0x64, 0x71, 0x38, 0x74, 0x6e, 0x32, 0x73, 0x6b, 0x38, 0x76, 0x61, 0x64, 0x39, 0x6a, 0x79, 0x74, 0x7a, 0x30, 0x75, 0x63, 0x66, 0x6e, 0x6b, 0x6b, 0x65, 0x6a, 0x64, 0x61, 0x77, 0x35, 0x6b, 0x35, 0x33, 0x77, 0x77, 0x73, 0x6a, 0x34, 0x64, 0x77, 0x72, 0x38, 0x79, 0x75, 0x75, 0x38, 0x6a, 0x75, 0x68, 0x78, 0x78, 0x68, 0x75, 0x68, 0x35, 0x70, 0x73, 0x77, 0x63, 0x70, 0x76, 0x68, 0x75, 0x79, 0x76, 0x6a, 0x35, 0x73, 0x76, 0x33, 0x65, 0x77, 0x6c, 0x61, 0x78, 0x71, 0x39, 0x30, 0x34, 0x63, 0x66, 0x64, 0x63, 0x70, 0x66, 0x35, 0x6a, 0x73, 0x38, 0x7a, 0x67, 0x74, 0x64, 0x78, 0x33, 0x39, 0x66, 0x38, 0x30, 0x67, 0x70, 0x70, 0x79, 0x75, 0x68, 0x36, 0x66, 0x6a, 0x68, 0x35, 0x6a, 0x66, 0x73, 0x66, 0x71, 0x61, 0x6d, 0x78, 0x32, 0x64, 0x35, 0x6d, 0x75, 0x66, 0x77, 0x77, 0x79, 0x6e, 0x38, 0x30, 0x75, 0x7a, 0x37, 0x76, 0x6e, 0x36, 0x72, 0x72, 0x79, 0x65, 0x6b, 0x72, 0x78, 0x77, 0x70, 0x72, 0x7a, 0x65, 0x39, 0x34, 0x78, 0x68, 0x38, 0x73, 0x75, 0x72, 0x33, 0x72, 0x70, 0x66, 0x6b, 0x66, 0x72, 0x79, 0x63, 0x39, 0x78, 0x79, 0x74, 0x67, 0x75, 0x6a, 0x6a, 0x33, 0x68, 0x39, 0x35, 0x6b, 0x79, 0x63, 0x36, 0x73, 0x70, 0x78, 0x76, 0x70, 0x66, 0x6e, 0x67, 0x6c, 0x74, 0x65, 0x78, 0x75, 0x79, 0x75, 0x74, 0x63, 0x71, 0x6b, 0x35, 0x78, 0x39, 0x61, 0x32, 0x63, 0x36, 0x66, 0x68, 0x76, 0x38, 0x35, 0x6d, 0x35, 0x37, 0x77, 0x6e, 0x74, 0x63, 0x6b, 0x6d, 0x30, 0x70, 0x71, 0x77, 0x34, 0x72, 0x66, 0x6d, 0x68, 0x61, 0x37, 0x7a, 0x63, 0x74, 0x35, 0x38, 0x34, 0x30, 0x37, 0x36, 0x66, 0x6a, 0x67, 0x70, 0x30, 0x6a, 0x33, 0x63, 0x6c, 0x78, 0x34, 0x63, 0x35, 0x36, 0x33, 0x6a, 0x66, 0x67, 0x71, 0x6c, 0x61, 0x6a, 0x75, 0x30, 0x66, 0x7a, 0x32, 0x64, 0x64, 0x6e, 0x64
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: None,
orchard_ivk_bytes: Some([
0x74, 0xaf, 0x71, 0x88, 0xc5, 0xa6, 0x14, 0x2f, 0x7d, 0x14, 0xfa, 0x7d, 0xfd, 0xe2, 0x31, 0x93, 0xf9, 0xa2, 0xc8, 0x0a, 0x90, 0x6d, 0x79, 0x2d, 0xc9, 0x98, 0xb5, 0x28, 0x4a, 0xe4, 0xc7, 0x2b, 0x09, 0x9b, 0xdb, 0x9c, 0xf5, 0x4c, 0xd5, 0x24, 0xbc, 0xd7, 0x4c, 0xc2, 0x18, 0x8b, 0x5a, 0x7e, 0x5a, 0x3f, 0x9f, 0x6d, 0x2c, 0x95, 0xa0, 0xd4, 0x9e, 0xad, 0x66, 0x3b, 0x79, 0xfb, 0x3f, 0x24
]),
unknown_ivk_typecode: 65535,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x6e, 0x70, 0x72, 0x30, 0x6d, 0x73, 0x65, 0x74, 0x6c, 0x63, 0x37, 0x36, 0x6a, 0x6d, 0x65, 0x61, 0x72, 0x35, 0x33, 0x64, 0x65, 0x6c, 0x35, 0x39, 0x70, 0x75, 0x68, 0x6a, 0x75, 0x65, 0x71, 0x6a, 0x35, 0x39, 0x34, 0x77, 0x39, 0x36, 0x75, 0x76, 0x70, 0x34, 0x73, 0x70, 0x75, 0x63, 0x71, 0x36, 0x38, 0x73, 0x79, 0x71, 0x63, 0x6b, 0x37, 0x33, 0x37, 0x78, 0x6e, 0x7a, 0x75, 0x61, 0x70, 0x37, 0x37, 0x79, 0x36, 0x64, 0x76, 0x33, 0x38, 0x64, 0x6c, 0x65, 0x77, 0x37, 0x38, 0x71, 0x6b, 0x73, 0x61, 0x73, 0x6e, 0x6d, 0x67, 0x67, 0x30, 0x35, 0x71, 0x6e, 0x37, 0x78, 0x6d, 0x65, 0x7a, 0x39, 0x63, 0x73, 0x73, 0x61, 0x35, 0x66, 0x74, 0x67, 0x6b, 0x67, 0x78, 0x72, 0x78, 0x38, 0x6a, 0x78, 0x71, 0x39, 0x79, 0x68, 0x33, 0x61, 0x6b, 0x74, 0x77, 0x6d, 0x33, 0x34, 0x39, 0x6c, 0x66, 0x30, 0x66, 0x71, 0x39, 0x71, 0x71, 0x7a, 0x79, 0x66, 0x33, 0x32
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: None,
orchard_ivk_bytes: Some([
0xec, 0xd2, 0x9d, 0xe5, 0x69, 0x73, 0x29, 0x03, 0x67, 0x9f, 0xab, 0x1f, 0x12, 0x56, 0x2a, 0x2b, 0x68, 0x3f, 0xa3, 0xd7, 0xaf, 0x47, 0x04, 0xa5, 0x22, 0x9a, 0xff, 0xff, 0xc9, 0x86, 0x3b, 0xf7, 0x0f, 0xce, 0xa1, 0x07, 0xab, 0x54, 0xb8, 0xf3, 0xd5, 0xab, 0xa2, 0xef, 0x95, 0x4c, 0x16, 0x2a, 0xe2, 0x1f, 0x8f, 0xf7, 0x54, 0xd9, 0xa1, 0x74, 0xa5, 0x51, 0x3d, 0x75, 0xc9, 0x5a, 0xe0, 0x33
]),
unknown_ivk_typecode: 65530,
unknown_ivk_bytes: Some(vec![
0x59, 0x65, 0x55, 0xed, 0x94, 0x94, 0xc6, 0xac, 0x89, 0x3c, 0x49, 0x72, 0x38, 0x33, 0xec, 0x89, 0x26, 0xc1, 0x03, 0x95, 0x86, 0xa7, 0xaf, 0xcf, 0x4a, 0x0d, 0x9c, 0x73, 0x1e, 0x98, 0x5d, 0x99, 0x58
]),
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x73, 0x7a, 0x6b, 0x64, 0x37, 0x75, 0x79, 0x6e, 0x39, 0x61, 0x74, 0x6c, 0x32, 0x74, 0x78, 0x72, 0x71, 0x66, 0x6d, 0x37, 0x34, 0x34, 0x78, 0x61, 0x34, 0x76, 0x7a, 0x33, 0x6c, 0x36, 0x7a, 0x73, 0x6b, 0x76, 0x73, 0x33, 0x64, 0x70, 0x6b, 0x61, 0x66, 0x36, 0x77, 0x6d, 0x34, 0x64, 0x33, 0x70, 0x67, 0x72, 0x33, 0x70, 0x76, 0x7a, 0x74, 0x6a, 0x6a, 0x38, 0x39, 0x6c, 0x70, 0x36, 0x36, 0x68, 0x64, 0x78, 0x7a, 0x7a, 0x36, 0x6d, 0x75, 0x6c, 0x68, 0x6d, 0x6d, 0x38, 0x78, 0x73, 0x75, 0x6a, 0x38, 0x6a, 0x74, 0x6e, 0x6b, 0x73, 0x34, 0x34, 0x35, 0x74, 0x67, 0x6b, 0x6d, 0x7a, 0x70, 0x71, 0x6d, 0x74, 0x63, 0x32, 0x64, 0x6d, 0x6a, 0x64, 0x74, 0x66, 0x34, 0x64, 0x67, 0x7a, 0x68, 0x77, 0x6e, 0x65, 0x32, 0x35, 0x63, 0x75, 0x64, 0x33, 0x78, 0x34, 0x6e, 0x6c, 0x61, 0x6c, 0x77, 0x64, 0x63, 0x6e, 0x37, 0x33, 0x65, 0x73, 0x78, 0x6c, 0x7a, 0x35, 0x6c, 0x37, 0x68, 0x72, 0x63, 0x37, 0x66, 0x66, 0x36, 0x64, 0x30, 0x70, 0x34, 0x74, 0x32, 0x73, 0x61, 0x6e, 0x6a, 0x33, 0x36, 0x34, 0x79, 0x37, 0x33, 0x33, 0x79, 0x36, 0x6e, 0x6e, 0x33, 0x35, 0x6c, 0x33, 0x70, 0x63, 0x75, 0x73, 0x76, 0x7a, 0x71, 0x7a, 0x70, 0x73, 0x6d, 0x73, 0x71, 0x6d, 0x72, 0x72, 0x6d, 0x39, 0x63, 0x64, 0x77, 0x76, 0x61, 0x6a, 0x39
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: Some([
0x83, 0x58, 0xa5, 0xcd, 0x36, 0x34, 0x09, 0x2f, 0xc3, 0x16, 0x11, 0xdf, 0x64, 0xa2, 0x20, 0x6e, 0xab, 0x0c, 0x5b, 0x8b, 0xcf, 0x05, 0x67, 0x38, 0xf0, 0x0b, 0xcc, 0xbc, 0x61, 0x5f, 0xfc, 0x87, 0x1f, 0x21, 0x10, 0x03, 0x3f, 0x1b, 0xa7, 0x4b, 0x89, 0xab, 0x19, 0x1f, 0x06, 0x51, 0xbd, 0xc5, 0x2c, 0x3a, 0xd2, 0x3b, 0xf9, 0xda, 0x50, 0x4b, 0x8f, 0xb2, 0xf0, 0x25, 0xe5, 0x37, 0xd6, 0x01
]),
orchard_ivk_bytes: None,
unknown_ivk_typecode: 65533,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x32, 0x77, 0x39, 0x65, 0x38, 0x33, 0x77, 0x79, 0x78, 0x30, 0x67, 0x67, 0x36, 0x71, 0x70, 0x79, 0x36, 0x35, 0x63, 0x70, 0x76, 0x74, 0x32, 0x67, 0x37, 0x6a, 0x77, 0x70, 0x39, 0x6b, 0x63, 0x6c, 0x74, 0x37, 0x33, 0x65, 0x6e, 0x64, 0x6e, 0x37, 0x7a, 0x7a, 0x36, 0x65, 0x6a, 0x37, 0x37, 0x30, 0x77, 0x74, 0x39, 0x76, 0x70, 0x71, 0x70, 0x63, 0x78, 0x74, 0x61, 0x6d, 0x73, 0x72, 0x72, 0x76, 0x37, 0x30, 0x36, 0x37, 0x63, 0x33, 0x70, 0x66, 0x34, 0x71, 0x75, 0x6a, 0x63, 0x34, 0x30, 0x37, 0x75, 0x37, 0x65, 0x76, 0x6e, 0x76, 0x76, 0x78, 0x72, 0x7a, 0x36, 0x75, 0x39, 0x32, 0x77, 0x79, 0x7a, 0x7a, 0x72, 0x72, 0x37, 0x72, 0x39, 0x70, 0x38, 0x75, 0x72, 0x76, 0x76, 0x79, 0x76, 0x72, 0x61, 0x74, 0x78, 0x70, 0x66, 0x71, 0x68, 0x30, 0x68, 0x35, 0x30, 0x78, 0x6d, 0x33, 0x6b, 0x65, 0x6d, 0x79, 0x35, 0x71, 0x7a, 0x30, 0x6c, 0x77, 0x67, 0x33
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: Some([
0x0d, 0x39, 0x3f, 0x2b, 0xe9, 0xb0, 0x2b, 0xfd, 0x36, 0x6c, 0xf1, 0xaa, 0xa0, 0xbb, 0x93, 0x28, 0xb2, 0xad, 0x02, 0xf9, 0xad, 0xdd, 0xef, 0x2e, 0x9a, 0xeb, 0xed, 0x71, 0x8c, 0x0e, 0x70, 0x06, 0xec, 0x34, 0x0e, 0xdd, 0x40, 0xfa, 0x94, 0x3b, 0xcc, 0x41, 0xca, 0x01, 0x98, 0xdd, 0x8c, 0xac, 0xea, 0xb2, 0xcc, 0x93, 0x20, 0x0a, 0x56, 0x9f, 0x97, 0xd9, 0x12, 0x60, 0x0a, 0x84, 0x1f, 0x02
]),
orchard_ivk_bytes: Some([
0xac, 0xa3, 0x8e, 0xa1, 0x8f, 0x84, 0x8e, 0x79, 0xec, 0x5f, 0x2b, 0x23, 0x78, 0x2d, 0x0b, 0x8c, 0xc9, 0x9a, 0x19, 0x26, 0x9a, 0x96, 0x36, 0x8c, 0x56, 0x89, 0x5c, 0x98, 0x51, 0xf0, 0x78, 0x78, 0x3a, 0xff, 0x6a, 0x3f, 0x60, 0x00, 0x1f, 0xbd, 0x89, 0x03, 0xfe, 0x65, 0x05, 0xdc, 0x21, 0x66, 0x3d, 0x28, 0x8e, 0xc6, 0x7c, 0xa9, 0x30, 0x4a, 0x54, 0x77, 0xff, 0x87, 0xe9, 0xf6, 0xf9, 0x22
]),
unknown_ivk_typecode: 65534,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x6c, 0x74, 0x73, 0x74, 0x32, 0x65, 0x68, 0x72, 0x68, 0x73, 0x73, 0x34, 0x36, 0x7a, 0x73, 0x65, 0x77, 0x6e, 0x64, 0x65, 0x71, 0x33, 0x38, 0x6d, 0x71, 0x37, 0x72, 0x7a, 0x78, 0x37, 0x78, 0x6b, 0x77, 0x66, 0x39, 0x75, 0x72, 0x6e, 0x63, 0x67, 0x35, 0x70, 0x68, 0x70, 0x68, 0x6e, 0x6b, 0x74, 0x6d, 0x77, 0x64, 0x38, 0x7a, 0x6e, 0x75, 0x38, 0x64, 0x32, 0x77, 0x67, 0x76, 0x33, 0x64, 0x35, 0x7a, 0x6d, 0x7a, 0x33, 0x73, 0x63, 0x70, 0x37, 0x6a, 0x32, 0x39, 0x76, 0x71, 0x30, 0x67, 0x72, 0x78, 0x72, 0x38, 0x30, 0x6b, 0x34, 0x7a, 0x63, 0x68, 0x66, 0x6a, 0x68, 0x73, 0x65, 0x71, 0x6d, 0x6c, 0x73, 0x61, 0x32, 0x32, 0x6a, 0x79, 0x72, 0x39, 0x6c, 0x73, 0x37, 0x39, 0x6c, 0x38, 0x37, 0x6a, 0x34, 0x33, 0x30, 0x36, 0x37, 0x73, 0x6e, 0x67, 0x6c, 0x79, 0x75, 0x78, 0x61, 0x61, 0x33, 0x67, 0x64, 0x65, 0x32, 0x73, 0x79, 0x35, 0x68, 0x71, 0x7a, 0x67, 0x39, 0x6d, 0x63, 0x34, 0x61, 0x70, 0x66, 0x6c, 0x39, 0x74, 0x77, 0x74, 0x37, 0x71, 0x74, 0x38, 0x64, 0x34, 0x6c, 0x71, 0x67, 0x7a, 0x34, 0x37, 0x78, 0x38, 0x70, 0x71, 0x6c, 0x66, 0x74, 0x75, 0x33, 0x72, 0x68, 0x36, 0x76, 0x33, 0x6b, 0x39, 0x61, 0x6e, 0x6b, 0x72, 0x75, 0x6e, 0x6a, 0x6c, 0x71, 0x63, 0x30, 0x39, 0x36, 0x6a, 0x64, 0x34, 0x36, 0x6e, 0x70, 0x79, 0x70, 0x6e, 0x35, 0x6a, 0x6b, 0x70, 0x65, 0x66, 0x7a, 0x39, 0x7a, 0x64, 0x79, 0x65, 0x32, 0x70, 0x6b, 0x75, 0x68, 0x6c, 0x7a, 0x75, 0x34, 0x7a, 0x78, 0x65, 0x73, 0x32, 0x6d, 0x72, 0x38, 0x6a, 0x6a, 0x6a, 0x71, 0x66, 0x77, 0x77, 0x30, 0x7a, 0x74, 0x30, 0x70, 0x61
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: Some([
0x92, 0x3e, 0x03, 0x5e, 0x1a, 0xdc, 0xb4, 0x28, 0x46, 0xe5, 0xc3, 0xe2, 0x95, 0x69, 0xe8, 0x75, 0xb9, 0xd6, 0x3f, 0x3c, 0x40, 0xb2, 0x14, 0x45, 0x54, 0x7d, 0x0a, 0x78, 0x9a, 0x1c, 0x40, 0x30, 0x11, 0x29, 0x7b, 0xb8, 0xaf, 0x3d, 0xd7, 0x8b, 0xe8, 0xbd, 0xe9, 0x5c, 0xbf, 0xb5, 0xc0, 0xd3, 0x9d, 0xcd, 0x46, 0xb6, 0x7d, 0xac, 0x8c, 0xa3, 0xd3, 0x00, 0x1b, 0xaa, 0xb5, 0xa0, 0xd5, 0x06
]),
orchard_ivk_bytes: Some([
0xec, 0xc1, 0xb7, 0xe5, 0xce, 0x05, 0xc1, 0xa6, 0x00, 0xf0, 0xd6, 0x7b, 0xdf, 0x92, 0xe1, 0xc3, 0x33, 0xb5, 0x18, 0x93, 0x12, 0xdc, 0xa2, 0xe5, 0x66, 0xeb, 0x47, 0x27, 0x3a, 0xd1, 0x54, 0x5a, 0xb0, 0x6c, 0x63, 0xa9, 0x51, 0x22, 0x93, 0x09, 0xeb, 0x2d, 0x65, 0x9f, 0x85, 0x40, 0x4d, 0x2b, 0xdd, 0xa9, 0x75, 0x82, 0x12, 0x5e, 0x67, 0x3e, 0xb8, 0xa3, 0x78, 0xb7, 0xa1, 0x91, 0x68, 0x19
]),
unknown_ivk_typecode: 65534,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x76, 0x6b, 0x37, 0x73, 0x61, 0x6e, 0x67, 0x70, 0x79, 0x37, 0x78, 0x75, 0x68, 0x77, 0x72, 0x6e, 0x74, 0x6e, 0x6b, 0x72, 0x33, 0x39, 0x74, 0x67, 0x65, 0x6d, 0x7a, 0x36, 0x67, 0x6a, 0x35, 0x6d, 0x6b, 0x77, 0x64, 0x37, 0x70, 0x6e, 0x6c, 0x68, 0x73, 0x6e, 0x6e, 0x75, 0x38, 0x76, 0x70, 0x6d, 0x30, 0x71, 0x30, 0x77, 0x6b, 0x37, 0x78, 0x38, 0x39, 0x74, 0x68, 0x6d, 0x76, 0x33, 0x64, 0x7a, 0x63, 0x37, 0x71, 0x76, 0x78, 0x79, 0x30, 0x75, 0x30, 0x77, 0x71, 0x64, 0x73, 0x6e, 0x64, 0x6a, 0x71, 0x6e, 0x39, 0x61, 0x6d, 0x72, 0x76, 0x38, 0x72, 0x39, 0x39, 0x78, 0x39, 0x74, 0x7a, 0x32, 0x68, 0x64, 0x68, 0x38, 0x64, 0x6d, 0x35, 0x78, 0x6e, 0x6b, 0x73, 0x71, 0x76, 0x76, 0x64, 0x33, 0x6b, 0x39, 0x78, 0x38, 0x66, 0x6d, 0x76, 0x75, 0x35, 0x77, 0x65, 0x72, 0x78, 0x6b, 0x75, 0x73, 0x66, 0x39, 0x65, 0x79, 0x61, 0x35, 0x64, 0x34, 0x67, 0x35, 0x61, 0x6c, 0x77, 0x77, 0x61, 0x7a, 0x61, 0x39, 0x34, 0x79, 0x66, 0x6c, 0x77, 0x65, 0x36, 0x71, 0x66, 0x78, 0x36, 0x66, 0x77, 0x66, 0x6c, 0x68, 0x65, 0x36, 0x38, 0x72, 0x75, 0x79, 0x78, 0x6a, 0x35, 0x78, 0x63, 0x68, 0x63, 0x61, 0x73, 0x6b, 0x6a, 0x32, 0x66, 0x64, 0x6d, 0x74, 0x64, 0x65, 0x64, 0x6e, 0x67, 0x36, 0x6b, 0x77, 0x38, 0x65, 0x6e, 0x73, 0x74, 0x35, 0x64, 0x72, 0x37, 0x36, 0x7a, 0x6a, 0x37, 0x64, 0x64, 0x7a, 0x66, 0x66, 0x67, 0x6e, 0x36, 0x6e, 0x66, 0x79, 0x72, 0x79, 0x7a, 0x39, 0x35, 0x6d, 0x70, 0x74, 0x72, 0x7a, 0x67, 0x72, 0x67, 0x37, 0x65, 0x7a, 0x65, 0x32, 0x6b, 0x76, 0x73, 0x74, 0x64, 0x79, 0x30, 0x65, 0x75
],
},
TestVector {
t_key_bytes: None,
sapling_ivk_bytes: None,
orchard_ivk_bytes: Some([
0xd8, 0xc7, 0x1c, 0x7c, 0x78, 0x9c, 0x54, 0x4c, 0x10, 0x04, 0x89, 0x83, 0x57, 0xd2, 0x43, 0x21, 0x97, 0x4e, 0x08, 0xfb, 0x06, 0x21, 0xf6, 0xc7, 0x8a, 0xbe, 0xbb, 0xb7, 0x63, 0xec, 0x87, 0xa6, 0xf8, 0xdc, 0x49, 0xc3, 0x7d, 0x61, 0x03, 0x97, 0x13, 0xe3, 0x54, 0x09, 0x44, 0x39, 0x6f, 0x9d, 0x91, 0x7f, 0x10, 0xae, 0xe0, 0x2e, 0xee, 0x3f, 0xbc, 0x41, 0xbc, 0x2d, 0x15, 0xc6, 0x3e, 0x15
]),
unknown_ivk_typecode: 65534,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x63, 0x78, 0x39, 0x6a, 0x6c, 0x63, 0x30, 0x64, 0x6a, 0x36, 0x32, 0x35, 0x61, 0x77, 0x72, 0x66, 0x70, 0x63, 0x32, 0x79, 0x39, 0x6d, 0x65, 0x63, 0x79, 0x79, 0x36, 0x34, 0x33, 0x6d, 0x66, 0x30, 0x33, 0x76, 0x66, 0x71, 0x7a, 0x64, 0x6a, 0x38, 0x32, 0x75, 0x6d, 0x35, 0x61, 0x79, 0x71, 0x39, 0x6c, 0x68, 0x79, 0x73, 0x34, 0x67, 0x37, 0x65, 0x6a, 0x73, 0x75, 0x30, 0x35, 0x35, 0x78, 0x78, 0x76, 0x6c, 0x61, 0x39, 0x71, 0x30, 0x71, 0x71, 0x38, 0x37, 0x6c, 0x66, 0x38, 0x7a, 0x73, 0x77, 0x65, 0x79, 0x77, 0x38, 0x39, 0x33, 0x6d, 0x71, 0x78, 0x77, 0x7a, 0x74, 0x75, 0x76, 0x36, 0x73, 0x6e, 0x37, 0x67, 0x30, 0x70, 0x64, 0x74, 0x72, 0x6c, 0x6e, 0x74, 0x32, 0x30, 0x6e, 0x66, 0x70, 0x64, 0x6d, 0x63, 0x72, 0x63, 0x6d, 0x76, 0x78, 0x35, 0x34, 0x78, 0x7a, 0x68, 0x65, 0x33, 0x74, 0x74, 0x6c, 0x33, 0x73, 0x7a, 0x77, 0x7a, 0x7a, 0x73, 0x71
],
},
TestVector {
t_key_bytes: Some([
0x12, 0xb5, 0x6d, 0xa9, 0xc3, 0x82, 0x85, 0x7d, 0xee, 0xcc, 0x40, 0xa9, 0x8d, 0x5f, 0x29, 0x35, 0x39, 0x5e, 0xe4, 0x76, 0x2d, 0xd2, 0x1a, 0xfd, 0xbb, 0x5d, 0x47, 0xfa, 0x9a, 0x6d, 0xd9, 0x84, 0x03, 0x9b, 0x50, 0xa1, 0x22, 0xf2, 0x6e, 0xde, 0x2e, 0x13, 0xff, 0x63, 0xb1, 0x30, 0xc9, 0x0f, 0x4c, 0x0f, 0x95, 0x1a, 0xe8, 0xa8, 0x1d, 0xdc, 0x1a, 0x4c, 0x98, 0x77, 0x54, 0xf1, 0x44, 0xc5, 0x36
]),
sapling_ivk_bytes: Some([
0x1d, 0x02, 0xf7, 0x39, 0xd2, 0xd8, 0x22, 0xdf, 0x5d, 0x41, 0xed, 0xc1, 0x22, 0xb2, 0x33, 0x09, 0x16, 0xba, 0x36, 0xca, 0x09, 0xe8, 0x0c, 0xf0, 0x7f, 0x99, 0xbe, 0x4a, 0x45, 0xfc, 0xe8, 0xe7, 0xe8, 0x7c, 0x09, 0xea, 0xf0, 0x44, 0xe0, 0x4f, 0x60, 0x8a, 0x23, 0x75, 0x15, 0x26, 0x8b, 0x46, 0xce, 0xc6, 0x4d, 0x9e, 0x07, 0x20, 0xb5, 0x85, 0xe2, 0x9d, 0xe8, 0x6d, 0x18, 0x33, 0xfa, 0x01
]),
orchard_ivk_bytes: Some([
0x77, 0x26, 0x72, 0x41, 0x0c, 0x80, 0x7d, 0x8b, 0x55, 0x2c, 0xa1, 0x70, 0xe6, 0x8b, 0xcf, 0xfc, 0xb7, 0xbc, 0x59, 0x02, 0x3e, 0x24, 0xc6, 0x55, 0xde, 0xec, 0xb1, 0x8e, 0xb8, 0xef, 0x8c, 0xc5, 0xdc, 0xdb, 0xf6, 0x5d, 0x3a, 0xb4, 0x34, 0xbc, 0x70, 0xab, 0xcc, 0xf4, 0xa5, 0x1b, 0x51, 0x80, 0x52, 0x94, 0xc8, 0xd4, 0xa2, 0x14, 0x16, 0x82, 0xdd, 0xcc, 0xd3, 0x94, 0x57, 0x2b, 0xe1, 0x3e
]),
unknown_ivk_typecode: 65534,
unknown_ivk_bytes: None,
unified_ivk: vec![
0x75, 0x69, 0x76, 0x6b, 0x31, 0x37, 0x6e, 0x35, 0x66, 0x36, 0x79, 0x73, 0x35, 0x77, 0x77, 0x6e, 0x30, 0x68, 0x32, 0x6a, 0x34, 0x30, 0x78, 0x38, 0x78, 0x63, 0x67, 0x73, 0x66, 0x70, 0x37, 0x65, 0x66, 0x38, 0x72, 0x72, 0x64, 0x70, 0x63, 0x6d, 0x73, 0x67, 0x30, 0x32, 0x6c, 0x7a, 0x6e, 0x35, 0x75, 0x73, 0x71, 0x32, 0x35, 0x63, 0x71, 0x72, 0x6b, 0x65, 0x63, 0x61, 0x73, 0x70, 0x36, 0x79, 0x6e, 0x35, 0x6c, 0x67, 0x33, 0x65, 0x64, 0x6b, 0x30, 0x36, 0x66, 0x76, 0x78, 0x71, 0x74, 0x6e, 0x77, 0x63, 0x72, 0x68, 0x33, 0x68, 0x78, 0x6c, 0x65, 0x7a, 0x72, 0x66, 0x70, 0x75, 0x33, 0x30, 0x37, 0x77, 0x67, 0x6e, 0x34, 0x74, 0x6d, 0x6b, 0x38, 0x78, 0x70, 0x6a, 0x67, 0x33, 0x71, 0x77, 0x68, 0x6c, 0x64, 0x77, 0x6d, 0x37, 0x37, 0x67, 0x65, 0x71, 0x6a, 0x33, 0x37, 0x6b, 0x35, 0x6c, 0x30, 0x6e, 0x70, 0x36, 0x67, 0x32, 0x6a, 0x63, 0x71, 0x61, 0x61, 0x74, 0x35, 0x68, 0x32, 0x30, 0x38, 0x6e, 0x79, 0x7a, 0x79, 0x70, 0x67, 0x64, 0x72, 0x35, 0x6d, 0x6a, 0x76, 0x73, 0x37, 0x79, 0x32, 0x36, 0x75, 0x72, 0x61, 0x6d, 0x33, 0x38, 0x38, 0x6c, 0x30, 0x61, 0x6d, 0x37, 0x39, 0x65, 0x61, 0x72, 0x66, 0x68, 0x70, 0x6d, 0x6c, 0x78, 0x67, 0x6d, 0x73, 0x37, 0x76, 0x32, 0x71, 0x32, 0x33, 0x70, 0x61, 0x6d, 0x76, 0x63, 0x78, 0x6e, 0x66, 0x78, 0x64, 0x76, 0x7a, 0x77, 0x39, 0x6e, 0x36, 0x6c, 0x64, 0x78, 0x66, 0x7a, 0x71, 0x65, 0x71, 0x30, 0x76, 0x68, 0x77, 0x66, 0x77, 0x66, 0x71, 0x75, 0x6b, 0x71, 0x7a, 0x32, 0x37, 0x7a, 0x77, 0x6b, 0x34, 0x30, 0x61, 0x61, 0x37, 0x38, 0x6e, 0x39, 0x35, 0x37, 0x67, 0x67, 0x77, 0x78, 0x78, 0x66, 0x6b, 0x39, 0x39, 0x32, 0x67, 0x37, 0x78, 0x32, 0x6c, 0x70, 0x71, 0x73, 0x7a, 0x79, 0x77, 0x33, 0x68, 0x76, 0x32, 0x39, 0x7a, 0x77, 0x74, 0x34, 0x73, 0x76, 0x72, 0x68, 0x71, 0x78, 0x6a, 0x6e, 0x74, 0x6b, 0x36, 0x75, 0x36, 0x68, 0x34, 0x76, 0x71, 0x76, 0x72, 0x36, 0x36, 0x7a, 0x33, 0x39, 0x6c, 0x6d, 0x6e, 0x75, 0x63, 0x77, 0x7a, 0x32, 0x71, 0x76, 0x36, 0x6a, 0x72, 0x35, 0x73, 0x67, 0x74, 0x70, 0x35, 0x71, 0x35, 0x66, 0x77, 0x7a, 0x74, 0x65, 0x7a, 0x68, 0x7a, 0x38, 0x39, 0x7a, 0x67, 0x32, 0x61, 0x37, 0x6c, 0x34, 0x33, 0x65, 0x65, 0x6b, 0x39, 0x76, 0x77, 0x78, 0x67, 0x61, 0x76, 0x34, 0x6a, 0x34, 0x6d, 0x74, 0x37, 0x67, 0x38
],
},
];

126
unified_incoming_viewing_keys.py Executable file
View File

@ -0,0 +1,126 @@
#!/usr/bin/env python3
import sys; assert sys.version_info[0] >= 3, "Python 3 required."
from random import Random
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.serialization import PublicFormat, Encoding
from zcash_test_vectors.output import render_args, render_tv, Some
from zcash_test_vectors.rand import Rand, randbytes
from zcash_test_vectors.orchard import key_components as orchard_key_components
from zcash_test_vectors.sapling import zip32 as sapling_zip32
from zcash_test_vectors.unified_encoding import encode_unified, decode_unified
from zcash_test_vectors.unified_encoding import P2PKH_ITEM, SAPLING_ITEM, ORCHARD_ITEM
def main():
args = render_args()
rng = Random(0xabad533d)
rand = Rand(randbytes(rng))
seed = rand.b(32)
test_vectors = []
for i in range(0, 10):
has_t_key = rand.bool()
if has_t_key:
c = rand.b(32)
privkey = ec.derive_private_key(int.from_bytes(rand.b(32), 'little'), ec.SECP256K1())
pubkey = privkey.public_key()
pubkey_bytes = pubkey.public_bytes(Encoding.X962, PublicFormat.CompressedPoint)
assert len(pubkey_bytes) == 33
assert pubkey_bytes[0] in (0x02, 0x03)
t_key_bytes = c + pubkey_bytes
else:
t_key_bytes = None
has_s_key = rand.bool()
if has_s_key:
root_key = sapling_zip32.ExtendedSpendingKey.master(seed)
purpose_key = root_key.child(sapling_zip32.hardened(32))
coin_key = purpose_key.child(sapling_zip32.hardened(133))
account_key = coin_key.child(sapling_zip32.hardened(i))
sapling_dk = account_key.to_extended_fvk().dk()
sapling_ivk = account_key.ivk()
sapling_ivk_bytes = bytes(sapling_dk) + bytes(sapling_ivk)
else:
sapling_ivk_bytes = None
has_o_key = (not has_s_key) or rand.bool()
if has_o_key:
orchard_sk = orchard_key_components.SpendingKey(rand.b(32))
orchard_fvk = orchard_key_components.FullViewingKey.from_spending_key(orchard_sk)
orchard_dk = orchard_fvk.dk
orchard_ivk = orchard_fvk.ivk()
orchard_ivk_bytes = bytes(orchard_dk) + bytes(orchard_ivk)
else:
orchard_ivk_bytes = None
# include an unknown item 1/4 of the time
has_unknown_item = rand.bool() and rand.bool()
# use the range reserved for experimental typecodes for unknowns
unknown_tc = rng.randrange(0xFFFA, 0xFFFF+1)
unknown_len = rng.randrange(32, 256)
if has_unknown_item:
unknown_bytes = b"".join([rand.b(unknown_len)])
else:
unknown_bytes = None
receivers = [
(ORCHARD_ITEM, orchard_ivk_bytes),
(SAPLING_ITEM, sapling_ivk_bytes),
(P2PKH_ITEM, t_key_bytes),
(unknown_tc, unknown_bytes),
]
uivk = encode_unified(rng, receivers, "uivk")
expected_lengths = {
P2PKH_ITEM: 65,
SAPLING_ITEM: 64,
ORCHARD_ITEM: 64,
unknown_tc: unknown_len
}
decoded = decode_unified(uivk, "uivk", expected_lengths)
assert decoded.get('orchard') == orchard_ivk_bytes
assert decoded.get('sapling') == sapling_ivk_bytes
assert decoded.get('transparent') == t_key_bytes
assert decoded.get('unknown') == ((unknown_tc, unknown_bytes) if unknown_bytes else None)
test_vectors.append({
't_key_bytes': t_key_bytes,
'sapling_ivk_bytes': sapling_ivk_bytes,
'orchard_ivk_bytes': orchard_ivk_bytes,
'unknown_ivk_typecode': unknown_tc,
'unknown_ivk_bytes': unknown_bytes,
'unified_ivk': uivk.encode(),
})
render_tv(
args,
'unified_incoming_viewing_keys',
(
('t_key_bytes', {
'rust_type': 'Option<[u8; 65]>',
'rust_fmt': lambda x: None if x is None else Some(x),
}),
('sapling_ivk_bytes', {
'rust_type': 'Option<[u8; 64]>',
'rust_fmt': lambda x: None if x is None else Some(x),
}),
('orchard_ivk_bytes', {
'rust_type': 'Option<[u8; 64]>',
'rust_fmt': lambda x: None if x is None else Some(x),
}),
('unknown_ivk_typecode', 'u32'),
('unknown_ivk_bytes', {
'rust_type': 'Option<Vec<u8>>',
'rust_fmt': lambda x: None if x is None else Some(x),
}),
('unified_ivk', 'Vec<u8>')
),
test_vectors,
)
if __name__ == "__main__":
main()