Stage 4a: both sides of every limit in the vectors, and the password P

Faults injected one at a time found four that the vectors let through:
R2 at 32 segments, R3 counting code points instead of UTF-16 code units
in an astral NFD, U+036F kept by normalizeWords, and DEL let through by
checkWords. The generators now write both sides of each limit: 32 and 33
segments, 255 and 256 bytes in letters of two and four bytes, 255 and 256
UTF-16 code units of NFD and 252 and 258 from astral decompositions,
bases of 8 and 9 runes, extensions of 3 and 4 also astral, the first and
the last mark of U+0300 to U+036F and their neighbours, and U+001F,
U+007E, U+007F, U+0080 and U+00A0 in a word. All four faults are caught
now.

wordKeyPassword is the password P of spec §38.1, as wordKeySalt is S, and
wordKey uses both: the tests compiled to JavaScript check P against the
one of Go, so that a wrong separator of the words is caught there too,
not only by the keys of 600 000 iterations on the VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.11
dev 2 days ago
parent 898be4153b
commit 16c217d744

@ -165,12 +165,15 @@ void _checkRound(int round) {
}
}
/// The password P of spec §38.1: the words joined by one U+0020, in UTF-8,
/// as Go's wordkey.Key passes them to PBKDF2. The caller clears it.
Uint8List wordKeyPassword(List<String> words) => utf8Bytes(words.join(' '));
/// The raw X25519 identity, 32 bytes, of [words] for the capsule
/// [capsuleId], of the round [round] of the chain whose hash is [chainHash]:
/// PBKDF2-HMAC-SHA256 of the words joined by one U+0020, in UTF-8, salted
/// with [wordKeySalt], [wordKeyRounds] iterations. Go's wordkey.Key. The
/// words are those that [normalizeWords] returns; the caller clears the
/// result.
/// PBKDF2-HMAC-SHA256 of [wordKeyPassword], salted with [wordKeySalt],
/// [wordKeyRounds] iterations. Go's wordkey.Key. The words are those that
/// [normalizeWords] returns; the caller clears the result.
Uint8List wordKey(
List<String> words,
List<int> chainHash,
@ -178,7 +181,7 @@ Uint8List wordKey(
List<int> capsuleId,
) {
final salt = wordKeySalt(chainHash, round, capsuleId);
final password = utf8Bytes(words.join(' '));
final password = wordKeyPassword(words);
try {
return pbkdf2HmacSha256(password, salt, wordKeyRounds, x25519Size);
} finally {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -5,7 +5,7 @@
/// The text of test/vectors/wordkey_vectors.json.
const wordkeyVectorsJson = r'''
{
"description": "The results of package wordkey of the Go reference (spec \u00a738.1) for lib/src/wordkey.dart; see tool/wordkey_go_vectors.go. Binary values are lower-case hex. normalize: a text and the words of wordkey.Normalize. check: words and the result of wordkey.Check, ok or the text of the error. keys: words, chain_hash, round and capsule_id; salt, the salt S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1.",
"description": "The results of package wordkey of the Go reference (spec \u00a738.1) for lib/src/wordkey.dart; see tool/wordkey_go_vectors.go. Binary values are lower-case hex. normalize: a text and the words of wordkey.Normalize. check: words and the result of wordkey.Check, ok or the text of the error. keys: words, chain_hash, round and capsule_id; password and salt, P and S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1.",
"generator": "tool/wordkey_go_vectors.go, go1.26.8",
"rounds": 600000,
"min_words": 6,
@ -46,6 +46,9 @@ const wordkeyVectorsJson = r'''
{"name":"the ideographic space","in":"756e6fe38080646f73","words":["756e6f","646f73"]},
{"name":"line and paragraph separators","in":"756e6fe280a8646f73e280a974726573","words":["756e6f","646f73","74726573"]},
{"name":"control characters that are not white space","in":"756e6f01646f737f726573","words":["756e6f01646f737f726573"]},
{"name":"the first and the last mark of U+0300 to U+036F","in":"61cc8062cdaf63","words":["616263"]},
{"name":"U+02FF and U+0370, around U+0300 to U+036F","in":"61cbbf62cdb063","words":["61cbbf62cdb163"]},
{"name":"every mark of U+0300 to U+036F","in":"78cc80cc81cc82cc83cc84cc85cc86cc87cc88cc89cc8acc8bcc8ccc8dcc8ecc8fcc90cc91cc92cc93cc94cc95cc96cc97cc98cc99cc9acc9bcc9ccc9dcc9ecc9fcca0cca1cca2cca3cca4cca5cca6cca7cca8cca9ccaaccabccacccadccaeccafccb0ccb1ccb2ccb3ccb4ccb5ccb6ccb7ccb8ccb9ccbaccbbccbcccbdccbeccbfcd80cd81cd82cd83cd84cd85cd86cd87cd88cd89cd8acd8bcd8ccd8dcd8ecd8fcd90cd91cd92cd93cd94cd95cd96cd97cd98cd99cd9acd9bcd9ccd9dcd9ecd9fcda0cda1cda2cda3cda4cda5cda6cda7cda8cda9cdaacdabcdaccdadcdaecdaf79","words":["7879"]},
{"name":"white space 1 of \u00a738.1","in":"610962","words":["61","62"]},
{"name":"white space 2 of \u00a738.1","in":"610a62","words":["61","62"]},
{"name":"white space 3 of \u00a738.1","in":"610b62","words":["61","62"]},
@ -407,10 +410,7 @@ const wordkeyVectorsJson = r'''
{"in":"e280896d6172e28082e28085e1bd88ce94cea5cea3cea3ce95ce8ecea3c285efbd86efbd95efbd8cefbd8ce28081d790d6b0e28086e2808a7472656ee28089636166c3a9e28080efbd86efbd95efbd8cefbd8ce28084e28081c785656d616ce280a8","words":["6d6172","cebfceb4cf85cf83cf83ceb5cf85cf83","efbd86efbd95efbd8cefbd8c","d790d6b0","7472656e","63616665","efbd86efbd95efbd8cefbd8c","c786656d616c"]},
{"in":"d790d6b00ced959ceab5adec96b4e28085e2819fc285e697a5e69cace8aa9ee28081","words":["d790d6b0","e18492e185a1e186abe18480e185aee186a8e1848be185a5","e697a5e69cace8aa9e"]},
{"in":"e19a8053545241c39f45e28088","words":["73747261c39f65"]},
{"in":"d5a1e38080e697a5e69cace8aa9e0c0ccea3ce91cea3e19a80c39fe2808109ea9f9ae28083e280886e69c3b16f094e49c3914fe2819fe19a80","words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"]},
{"in":"d28378e19a80e28083e2808670657272cdb86f2c0ae28085c28561cc81cca3e19a80e280a8e280836e69c3b16fe28088","words":["d28378","70657272cdb86f2c","61","6e696e6f"]},
{"in":"0d6b656c76696e0be0b881e0b8b4e280af52c38953554dc389e280afc38152424f4c0b61cc81cca3e280846d6172e19a80e2b1a5e280a8f09f98800ce28081e280a9f09f9880e2808a","words":["6b656c76696e","e0b881e0b8b4","726573756d65","6172626f6c","61","6d6172","e2b1a5","f09f9880","f09f9880"]},
{"in":"0c7665726465e280afe1bd88ce94cea5cea3cea3ce95ce8ecea30d706572726f2ce2808178cdefb88f850a","words":["7665726465","cebfceb4cf85cf83cf83ceb5cf85cf83","706572726f2c","78efbfbdefb88fefbfbd"]}
{"in":"d5a1e38080e697a5e69cace8aa9e0c0ccea3ce91cea3e19a80c39fe2808109ea9f9ae28083e280886e69c3b16f094e49c3914fe2819fe19a80","words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"]}
],
"check": [
{"name":"the six words of TestCheck","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"result":"ok"},
@ -445,6 +445,11 @@ const wordkeyVectorsJson = r'''
{"name":"refusals before the count","words":["616161","626262","63c2ad"],"result":"wordkey: the words hold the invisible character U+00AD"},
{"name":"empty words","words":["","","616161","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"a word of three spaces given as it is","words":["202020","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"U+001F is a control","words":["611f62","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+001F"},
{"name":"U+007E is not","words":["617e62","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"U+007F is a control","words":["617f62","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+007F"},
{"name":"U+0080 is a control","words":["61c28062","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+0080"},
{"name":"U+00A0 inside a word given as it is is not","words":["61c2a062","626262","636363","646464","656565","666666"],"result":"ok"},
{"words":["d790d6b0","6172626f6c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["6e61697665","61","cebfceb4cf85cf83cf83ceb5cf85cf82","706572726f2c","efbd86efbd95efbd8cefbd8c","6172efbfbdefbfbd626f6c","d28378","616c","eaadb0eaadb1eaadb2"],"result":"ok"},
{"words":["6d6172efb88f","6c61","d790d6b0","6b656c76696e","e2b1a5","cf83ceb1cf83","616c","eaadb0eaadb1eaadb2","f09090a8"],"result":"wordkey: the words hold the invisible character U+FE0F"},
@ -773,17 +778,18 @@ const wordkeyVectorsJson = r'''
{"words":["d790d6b0","e18492e185a1e186abe18480e185aee186a8e1848be185a5","e697a5e69cace8aa9e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 2"},
{"words":["73747261c39f65"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["d28378","70657272cdb86f2c","61","6e696e6f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["6b656c76696e","e0b881e0b8b4","726573756d65","6172626f6c","61","6d6172","e2b1a5","f09f9880","f09f9880"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["7665726465","cebfceb4cf85cf83cf83ceb5cf85cf83","706572726f2c","78efbfbdefb88fefbfbd"],"result":"wordkey: the words hold the invisible character U+FE0F"},
{"words":["c990","efbca6efbcb5efbcacefbcac","e182a0","e0b881e0b8b4"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["6c756e61","63617361","c2a1686f6c6121","e284aa656c76696e","c4b07374616e62756c","63617361","6c756e61","63617361","6c756e61"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["63617361","c990"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["72c3a973756dc3a9","78","736f6c","6c756e61","efac80","6c756e61"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["e182a0"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["cea3ce91cea3","e284aa656c76696e","cea3ce91cea3","6465","63617361","434146c389"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["70616e","e0b881e0b8b4","70616e","7472656e","706572726f","706572726f","7665726465","4e49c3914f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["6c756e61","e0b881e0b8b4","e284aa656c76696e","706572726f2c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["ea9e8c","65cc81","78efb8a0","d4b1","72c3a973756dc3a9","efbca6efbcb5efbcacefbcac","7472656e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["6d6172","d790d6b0","c8ba","736f6c","c8ba"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 2"},
{"words":["72c3a973756dc3a9","6c756e61","78","706572726f2c","706572726f","e697a5e69cace8aa9e","736f6c"],"result":"ok"},
{"words":["e284aa656c76696e","78efb8a0","736f6c","7665726465","c990"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["d4b1"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["70616e","d790d6b0","6c756e61","63617361","c2a1686f6c6121","e284aa656c76696e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["f0909080","c8ba"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["706572726f2cf48fbfbd","70616e","e18ea0e18ea1e18ea2","6465","c990","636166c3a9","d09cd09ed0a1d09ad092d090","d09cd0bed181d0bad0b2d0b0efbfbe","61cca3cc81"],"result":"wordkey: the words hold U+FFFE, unassigned in Unicode 18.0.0"},
{"words":["706572726f","6c756e61","706572726f","ed959ceab5adec96b4","6d6172","cea3ce91cea3","6465","63617361","434146c389"],"result":"ok"},
{"words":["6465","c3bc626572","d5a1","7665726465","e1bd80ceb4cf85cf83cf83ceb5cf8dcf82cdb8","c3816261636f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["c2a1686f6c6121","736f6c","cea3cebfcf86ceafceb1","70616e","c4b07374616e62756c","636166c3a9","78cd85","61cc81cca3","63617361"],"result":"ok"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
@ -921,17 +927,13 @@ const wordkeyVectorsJson = r'''
{"words":["e1ba9e","6d6172","6465","6c61","63616e6369c3b36e","78efb8a0","6c756e61","706572726f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["6c756e61","706572726f2c","63617361","ed959ceab5adec96b4","616c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["736f6c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["d28378","6c756e61cdb8","70616e","cea3ce91cea3","61c3b16fc080","4e49c3914f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["70616e","7665726465","78cd85","6c61","7665726465","61cc81cca3","78","6d6172","53545241c39f45"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["736f6c","53545241c39f45","63617361","ed959ceab5adec96b4"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["ea9e8c","7472656e","7665726465","e0b881e0b8b4","d09cd0bed181d0bad0b2d0b0","70616e","706572726f","c4b07374616e62756c"],"result":"ok"},
{"words":["70616e","78e1aab0","7665726465","61c3b16f","7472656e","f09ea480","70616e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"}
{"words":["d28378","6c756e61cdb8","70616e","cea3ce91cea3","61c3b16fc080","4e49c3914f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"}
],
"keys": [
{"name":"the vector of spec \u00a738.1","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1000,"capsule_id":"000102030405060708090a0b0c0d0e0f","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1000|000102030405060708090a0b0c0d0e0f","key":"fceec4d8ca8de86c85a1f26ed49f82a2b38431bd0ce36db995ae7dfd49b96e41","key_1000":"1028e1b9b04902cc9d70b4a0bad785939b45f1b6d4c293378483c7be1c6f95c8","recipient":"age1fqk6hflp8q5um2qrl5ckd8lu4x75rhtuncfus7f7up3v3v0zss0stdpqkr"},
{"name":"normalized words of other scripts, the next round","words":["616261636f","6172626f6c","6e696e6f","cf83ceb1cf83","697374616e62756c","e18492e185a1e186abe18480e185aee186a8e1848be185a5","f09f9880"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1001,"capsule_id":"000102030405060708090a0b0c0d0e0f","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1001|000102030405060708090a0b0c0d0e0f","key":"d8f9ec679333a961472c33b35143958f7a867d6d701047310bd3869cde06eb72","key_1000":"82018540b63893f0839b4e18a84bcee538f60f5d54b38b6bbda1b607de73817e","recipient":"age1xedq0ct3kasmwtkxjk2s5z8z7y6pv52k6lrw82vj3e0yp02c6u2qld2s27"},
{"name":"the largest round of 53 bits, another chain hash and capsule_id","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"abababababababababababababababababababababababababababababababab","round":9007199254740991,"capsule_id":"ffffffffffffffffffffffffffffffff","salt":"DateKeys llave de palabras v2|abababababababababababababababababababababababababababababababab|9007199254740991|ffffffffffffffffffffffffffffffff","key":"32b1a83dee069045054c2d044fb83802ac5bdd4122883e22ccc4bf42efdf54c3","key_1000":"a1264e85f593acdd9d4ab3fb3621f787c77ae3b29dc2cf33f67c868d471225f8","recipient":"age19ys0af5dp7gm6wydupg7ej29wf08xuaypwn507k3kvg8lzxxyd7qweuwec"},
{"name":"a word of a surrogate in UTF-8 bytes, round 0, no capsule_id","words":["eda080","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":0,"capsule_id":"","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|0|","key":"47261f98a8ac68e4f100c75e929bb3b9b719a43ca47a5e173bfeefa409a728a5","key_1000":"5c367b7a1282a777efd622bf070cc31048da05f9d9d79affd41df5da43bbcb7a","recipient":"age122r0ul49gphvqdtdq9sngwd70p3t26lslz2xsf7qgvjcywp6gacs7ymd0l"}
{"name":"the vector of spec \u00a738.1","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1000,"capsule_id":"000102030405060708090a0b0c0d0e0f","password":"706572726f206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1000|000102030405060708090a0b0c0d0e0f","key":"fceec4d8ca8de86c85a1f26ed49f82a2b38431bd0ce36db995ae7dfd49b96e41","key_1000":"1028e1b9b04902cc9d70b4a0bad785939b45f1b6d4c293378483c7be1c6f95c8","recipient":"age1fqk6hflp8q5um2qrl5ckd8lu4x75rhtuncfus7f7up3v3v0zss0stdpqkr"},
{"name":"normalized words of other scripts, the next round","words":["616261636f","6172626f6c","6e696e6f","cf83ceb1cf83","697374616e62756c","e18492e185a1e186abe18480e185aee186a8e1848be185a5","f09f9880"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1001,"capsule_id":"000102030405060708090a0b0c0d0e0f","password":"616261636f206172626f6c206e696e6f20cf83ceb1cf8320697374616e62756c20e18492e185a1e186abe18480e185aee186a8e1848be185a520f09f9880","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1001|000102030405060708090a0b0c0d0e0f","key":"d8f9ec679333a961472c33b35143958f7a867d6d701047310bd3869cde06eb72","key_1000":"82018540b63893f0839b4e18a84bcee538f60f5d54b38b6bbda1b607de73817e","recipient":"age1xedq0ct3kasmwtkxjk2s5z8z7y6pv52k6lrw82vj3e0yp02c6u2qld2s27"},
{"name":"the largest round of 53 bits, another chain hash and capsule_id","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"abababababababababababababababababababababababababababababababab","round":9007199254740991,"capsule_id":"ffffffffffffffffffffffffffffffff","password":"706572726f206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|abababababababababababababababababababababababababababababababab|9007199254740991|ffffffffffffffffffffffffffffffff","key":"32b1a83dee069045054c2d044fb83802ac5bdd4122883e22ccc4bf42efdf54c3","key_1000":"a1264e85f593acdd9d4ab3fb3621f787c77ae3b29dc2cf33f67c868d471225f8","recipient":"age19ys0af5dp7gm6wydupg7ej29wf08xuaypwn507k3kvg8lzxxyd7qweuwec"},
{"name":"a word of a surrogate in UTF-8 bytes, round 0, no capsule_id","words":["eda080","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":0,"capsule_id":"","password":"eda080206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|0|","key":"47261f98a8ac68e4f100c75e929bb3b9b719a43ca47a5e173bfeefa409a728a5","key_1000":"5c367b7a1282a777efd622bf070cc31048da05f9d9d79affd41df5da43bbcb7a","recipient":"age122r0ul49gphvqdtdq9sngwd70p3t26lslz2xsf7qgvjcywp6gacs7ymd0l"}
]
}
''';

@ -1,5 +1,5 @@
{
"description": "The results of package wordkey of the Go reference (spec \u00a738.1) for lib/src/wordkey.dart; see tool/wordkey_go_vectors.go. Binary values are lower-case hex. normalize: a text and the words of wordkey.Normalize. check: words and the result of wordkey.Check, ok or the text of the error. keys: words, chain_hash, round and capsule_id; salt, the salt S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1.",
"description": "The results of package wordkey of the Go reference (spec \u00a738.1) for lib/src/wordkey.dart; see tool/wordkey_go_vectors.go. Binary values are lower-case hex. normalize: a text and the words of wordkey.Normalize. check: words and the result of wordkey.Check, ok or the text of the error. keys: words, chain_hash, round and capsule_id; password and salt, P and S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1.",
"generator": "tool/wordkey_go_vectors.go, go1.26.8",
"rounds": 600000,
"min_words": 6,
@ -40,6 +40,9 @@
{"name":"the ideographic space","in":"756e6fe38080646f73","words":["756e6f","646f73"]},
{"name":"line and paragraph separators","in":"756e6fe280a8646f73e280a974726573","words":["756e6f","646f73","74726573"]},
{"name":"control characters that are not white space","in":"756e6f01646f737f726573","words":["756e6f01646f737f726573"]},
{"name":"the first and the last mark of U+0300 to U+036F","in":"61cc8062cdaf63","words":["616263"]},
{"name":"U+02FF and U+0370, around U+0300 to U+036F","in":"61cbbf62cdb063","words":["61cbbf62cdb163"]},
{"name":"every mark of U+0300 to U+036F","in":"78cc80cc81cc82cc83cc84cc85cc86cc87cc88cc89cc8acc8bcc8ccc8dcc8ecc8fcc90cc91cc92cc93cc94cc95cc96cc97cc98cc99cc9acc9bcc9ccc9dcc9ecc9fcca0cca1cca2cca3cca4cca5cca6cca7cca8cca9ccaaccabccacccadccaeccafccb0ccb1ccb2ccb3ccb4ccb5ccb6ccb7ccb8ccb9ccbaccbbccbcccbdccbeccbfcd80cd81cd82cd83cd84cd85cd86cd87cd88cd89cd8acd8bcd8ccd8dcd8ecd8fcd90cd91cd92cd93cd94cd95cd96cd97cd98cd99cd9acd9bcd9ccd9dcd9ecd9fcda0cda1cda2cda3cda4cda5cda6cda7cda8cda9cdaacdabcdaccdadcdaecdaf79","words":["7879"]},
{"name":"white space 1 of \u00a738.1","in":"610962","words":["61","62"]},
{"name":"white space 2 of \u00a738.1","in":"610a62","words":["61","62"]},
{"name":"white space 3 of \u00a738.1","in":"610b62","words":["61","62"]},
@ -401,10 +404,7 @@
{"in":"e280896d6172e28082e28085e1bd88ce94cea5cea3cea3ce95ce8ecea3c285efbd86efbd95efbd8cefbd8ce28081d790d6b0e28086e2808a7472656ee28089636166c3a9e28080efbd86efbd95efbd8cefbd8ce28084e28081c785656d616ce280a8","words":["6d6172","cebfceb4cf85cf83cf83ceb5cf85cf83","efbd86efbd95efbd8cefbd8c","d790d6b0","7472656e","63616665","efbd86efbd95efbd8cefbd8c","c786656d616c"]},
{"in":"d790d6b00ced959ceab5adec96b4e28085e2819fc285e697a5e69cace8aa9ee28081","words":["d790d6b0","e18492e185a1e186abe18480e185aee186a8e1848be185a5","e697a5e69cace8aa9e"]},
{"in":"e19a8053545241c39f45e28088","words":["73747261c39f65"]},
{"in":"d5a1e38080e697a5e69cace8aa9e0c0ccea3ce91cea3e19a80c39fe2808109ea9f9ae28083e280886e69c3b16f094e49c3914fe2819fe19a80","words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"]},
{"in":"d28378e19a80e28083e2808670657272cdb86f2c0ae28085c28561cc81cca3e19a80e280a8e280836e69c3b16fe28088","words":["d28378","70657272cdb86f2c","61","6e696e6f"]},
{"in":"0d6b656c76696e0be0b881e0b8b4e280af52c38953554dc389e280afc38152424f4c0b61cc81cca3e280846d6172e19a80e2b1a5e280a8f09f98800ce28081e280a9f09f9880e2808a","words":["6b656c76696e","e0b881e0b8b4","726573756d65","6172626f6c","61","6d6172","e2b1a5","f09f9880","f09f9880"]},
{"in":"0c7665726465e280afe1bd88ce94cea5cea3cea3ce95ce8ecea30d706572726f2ce2808178cdefb88f850a","words":["7665726465","cebfceb4cf85cf83cf83ceb5cf85cf83","706572726f2c","78efbfbdefb88fefbfbd"]}
{"in":"d5a1e38080e697a5e69cace8aa9e0c0ccea3ce91cea3e19a80c39fe2808109ea9f9ae28083e280886e69c3b16f094e49c3914fe2819fe19a80","words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"]}
],
"check": [
{"name":"the six words of TestCheck","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"result":"ok"},
@ -439,6 +439,11 @@
{"name":"refusals before the count","words":["616161","626262","63c2ad"],"result":"wordkey: the words hold the invisible character U+00AD"},
{"name":"empty words","words":["","","616161","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"a word of three spaces given as it is","words":["202020","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"U+001F is a control","words":["611f62","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+001F"},
{"name":"U+007E is not","words":["617e62","626262","636363","646464","656565","666666"],"result":"ok"},
{"name":"U+007F is a control","words":["617f62","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+007F"},
{"name":"U+0080 is a control","words":["61c28062","626262","636363","646464","656565","666666"],"result":"wordkey: the words hold the control character U+0080"},
{"name":"U+00A0 inside a word given as it is is not","words":["61c2a062","626262","636363","646464","656565","666666"],"result":"ok"},
{"words":["d790d6b0","6172626f6c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["6e61697665","61","cebfceb4cf85cf83cf83ceb5cf85cf82","706572726f2c","efbd86efbd95efbd8cefbd8c","6172efbfbdefbfbd626f6c","d28378","616c","eaadb0eaadb1eaadb2"],"result":"ok"},
{"words":["6d6172efb88f","6c61","d790d6b0","6b656c76696e","e2b1a5","cf83ceb1cf83","616c","eaadb0eaadb1eaadb2","f09090a8"],"result":"wordkey: the words hold the invisible character U+FE0F"},
@ -767,17 +772,18 @@
{"words":["d790d6b0","e18492e185a1e186abe18480e185aee186a8e1848be185a5","e697a5e69cace8aa9e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 2"},
{"words":["73747261c39f65"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["d5a1","e697a5e69cace8aa9e","cf83ceb1cf83","c39f","ea9f9b","6e696e6f","6e696e6f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["d28378","70657272cdb86f2c","61","6e696e6f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["6b656c76696e","e0b881e0b8b4","726573756d65","6172626f6c","61","6d6172","e2b1a5","f09f9880","f09f9880"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["7665726465","cebfceb4cf85cf83cf83ceb5cf85cf83","706572726f2c","78efbfbdefb88fefbfbd"],"result":"wordkey: the words hold the invisible character U+FE0F"},
{"words":["c990","efbca6efbcb5efbcacefbcac","e182a0","e0b881e0b8b4"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["6c756e61","63617361","c2a1686f6c6121","e284aa656c76696e","c4b07374616e62756c","63617361","6c756e61","63617361","6c756e61"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["63617361","c990"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["72c3a973756dc3a9","78","736f6c","6c756e61","efac80","6c756e61"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["e182a0"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["cea3ce91cea3","e284aa656c76696e","cea3ce91cea3","6465","63617361","434146c389"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["70616e","e0b881e0b8b4","70616e","7472656e","706572726f","706572726f","7665726465","4e49c3914f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["6c756e61","e0b881e0b8b4","e284aa656c76696e","706572726f2c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["ea9e8c","65cc81","78efb8a0","d4b1","72c3a973756dc3a9","efbca6efbcb5efbcacefbcac","7472656e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["6d6172","d790d6b0","c8ba","736f6c","c8ba"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 2"},
{"words":["72c3a973756dc3a9","6c756e61","78","706572726f2c","706572726f","e697a5e69cace8aa9e","736f6c"],"result":"ok"},
{"words":["e284aa656c76696e","78efb8a0","736f6c","7665726465","c990"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 3"},
{"words":["d4b1"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["70616e","d790d6b0","6c756e61","63617361","c2a1686f6c6121","e284aa656c76696e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["f0909080","c8ba"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
{"words":["706572726f2cf48fbfbd","70616e","e18ea0e18ea1e18ea2","6465","c990","636166c3a9","d09cd09ed0a1d09ad092d090","d09cd0bed181d0bad0b2d0b0efbfbe","61cca3cc81"],"result":"wordkey: the words hold U+FFFE, unassigned in Unicode 18.0.0"},
{"words":["706572726f","6c756e61","706572726f","ed959ceab5adec96b4","6d6172","cea3ce91cea3","6465","63617361","434146c389"],"result":"ok"},
{"words":["6465","c3bc626572","d5a1","7665726465","e1bd80ceb4cf85cf83cf83ceb5cf8dcf82cdb8","c3816261636f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["c2a1686f6c6121","736f6c","cea3cebfcf86ceafceb1","70616e","c4b07374616e62756c","636166c3a9","78cd85","61cc81cca3","63617361"],"result":"ok"},
{"words":[],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 0"},
@ -915,16 +921,12 @@
{"words":["e1ba9e","6d6172","6465","6c61","63616e6369c3b36e","78efb8a0","6c756e61","706572726f"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["6c756e61","706572726f2c","63617361","ed959ceab5adec96b4","616c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["736f6c"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 1"},
{"words":["d28378","6c756e61cdb8","70616e","cea3ce91cea3","61c3b16fc080","4e49c3914f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"},
{"words":["70616e","7665726465","78cd85","6c61","7665726465","61cc81cca3","78","6d6172","53545241c39f45"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 5"},
{"words":["736f6c","53545241c39f45","63617361","ed959ceab5adec96b4"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"},
{"words":["ea9e8c","7472656e","7665726465","e0b881e0b8b4","d09cd0bed181d0bad0b2d0b0","70616e","706572726f","c4b07374616e62756c"],"result":"ok"},
{"words":["70616e","78e1aab0","7665726465","61c3b16f","7472656e","f09ea480","70616e"],"result":"wordkey: a key of words needs at least 6 different words of 3 or more letters, not 4"}
{"words":["d28378","6c756e61cdb8","70616e","cea3ce91cea3","61c3b16fc080","4e49c3914f"],"result":"wordkey: the words hold U+0378, unassigned in Unicode 18.0.0"}
],
"keys": [
{"name":"the vector of spec \u00a738.1","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1000,"capsule_id":"000102030405060708090a0b0c0d0e0f","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1000|000102030405060708090a0b0c0d0e0f","key":"fceec4d8ca8de86c85a1f26ed49f82a2b38431bd0ce36db995ae7dfd49b96e41","key_1000":"1028e1b9b04902cc9d70b4a0bad785939b45f1b6d4c293378483c7be1c6f95c8","recipient":"age1fqk6hflp8q5um2qrl5ckd8lu4x75rhtuncfus7f7up3v3v0zss0stdpqkr"},
{"name":"normalized words of other scripts, the next round","words":["616261636f","6172626f6c","6e696e6f","cf83ceb1cf83","697374616e62756c","e18492e185a1e186abe18480e185aee186a8e1848be185a5","f09f9880"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1001,"capsule_id":"000102030405060708090a0b0c0d0e0f","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1001|000102030405060708090a0b0c0d0e0f","key":"d8f9ec679333a961472c33b35143958f7a867d6d701047310bd3869cde06eb72","key_1000":"82018540b63893f0839b4e18a84bcee538f60f5d54b38b6bbda1b607de73817e","recipient":"age1xedq0ct3kasmwtkxjk2s5z8z7y6pv52k6lrw82vj3e0yp02c6u2qld2s27"},
{"name":"the largest round of 53 bits, another chain hash and capsule_id","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"abababababababababababababababababababababababababababababababab","round":9007199254740991,"capsule_id":"ffffffffffffffffffffffffffffffff","salt":"DateKeys llave de palabras v2|abababababababababababababababababababababababababababababababab|9007199254740991|ffffffffffffffffffffffffffffffff","key":"32b1a83dee069045054c2d044fb83802ac5bdd4122883e22ccc4bf42efdf54c3","key_1000":"a1264e85f593acdd9d4ab3fb3621f787c77ae3b29dc2cf33f67c868d471225f8","recipient":"age19ys0af5dp7gm6wydupg7ej29wf08xuaypwn507k3kvg8lzxxyd7qweuwec"},
{"name":"a word of a surrogate in UTF-8 bytes, round 0, no capsule_id","words":["eda080","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":0,"capsule_id":"","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|0|","key":"47261f98a8ac68e4f100c75e929bb3b9b719a43ca47a5e173bfeefa409a728a5","key_1000":"5c367b7a1282a777efd622bf070cc31048da05f9d9d79affd41df5da43bbcb7a","recipient":"age122r0ul49gphvqdtdq9sngwd70p3t26lslz2xsf7qgvjcywp6gacs7ymd0l"}
{"name":"the vector of spec \u00a738.1","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1000,"capsule_id":"000102030405060708090a0b0c0d0e0f","password":"706572726f206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1000|000102030405060708090a0b0c0d0e0f","key":"fceec4d8ca8de86c85a1f26ed49f82a2b38431bd0ce36db995ae7dfd49b96e41","key_1000":"1028e1b9b04902cc9d70b4a0bad785939b45f1b6d4c293378483c7be1c6f95c8","recipient":"age1fqk6hflp8q5um2qrl5ckd8lu4x75rhtuncfus7f7up3v3v0zss0stdpqkr"},
{"name":"normalized words of other scripts, the next round","words":["616261636f","6172626f6c","6e696e6f","cf83ceb1cf83","697374616e62756c","e18492e185a1e186abe18480e185aee186a8e1848be185a5","f09f9880"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":1001,"capsule_id":"000102030405060708090a0b0c0d0e0f","password":"616261636f206172626f6c206e696e6f20cf83ceb1cf8320697374616e62756c20e18492e185a1e186abe18480e185aee186a8e1848be185a520f09f9880","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|1001|000102030405060708090a0b0c0d0e0f","key":"d8f9ec679333a961472c33b35143958f7a867d6d701047310bd3869cde06eb72","key_1000":"82018540b63893f0839b4e18a84bcee538f60f5d54b38b6bbda1b607de73817e","recipient":"age1xedq0ct3kasmwtkxjk2s5z8z7y6pv52k6lrw82vj3e0yp02c6u2qld2s27"},
{"name":"the largest round of 53 bits, another chain hash and capsule_id","words":["706572726f","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"abababababababababababababababababababababababababababababababab","round":9007199254740991,"capsule_id":"ffffffffffffffffffffffffffffffff","password":"706572726f206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|abababababababababababababababababababababababababababababababab|9007199254740991|ffffffffffffffffffffffffffffffff","key":"32b1a83dee069045054c2d044fb83802ac5bdd4122883e22ccc4bf42efdf54c3","key_1000":"a1264e85f593acdd9d4ab3fb3621f787c77ae3b29dc2cf33f67c868d471225f8","recipient":"age19ys0af5dp7gm6wydupg7ej29wf08xuaypwn507k3kvg8lzxxyd7qweuwec"},
{"name":"a word of a surrogate in UTF-8 bytes, round 0, no capsule_id","words":["eda080","6c756e61","63617361","7665726465","7472656e","6d6172"],"chain_hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","round":0,"capsule_id":"","password":"eda080206c756e612063617361207665726465207472656e206d6172","salt":"DateKeys llave de palabras v2|52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971|0|","key":"47261f98a8ac68e4f100c75e929bb3b9b719a43ca47a5e173bfeefa409a728a5","key_1000":"5c367b7a1282a777efd622bf070cc31048da05f9d9d79affd41df5da43bbcb7a","recipient":"age122r0ul49gphvqdtdq9sngwd70p3t26lslz2xsf7qgvjcywp6gacs7ymd0l"}
]
}

@ -93,8 +93,11 @@ void main() {
final salt = wordKeySalt(chain, round, capsuleId);
expect(salt, utf8Bytes(c['salt']! as String), reason: label(c));
// The password is the words joined by one U+0020, in UTF-8: with the
// salt and 1000 iterations, the PBKDF2 of Go.
final password = utf8Bytes(words.join(' '));
// salt and 1000 iterations, the PBKDF2 of Go. wordKey derives with
// the same two and 600 000 iterations, on the VM in
// wordkey_vm_test.dart.
final password = wordKeyPassword(words);
expect(toHex(password), c['password'], reason: label(c));
expect(
toHex(pbkdf2HmacSha256(password, salt, 1000, 32)),
c['key_1000'],

@ -720,6 +720,20 @@ func namedStrings() []stringCase {
{"ZWNJ alone in a line", "a\n\u200c"},
{"an empty line", "a\n\nb"},
{"a text of bidirectional controls only", "\u2066\u2069"},
// The limits of R2, R3 and R6b, on both sides.
{"32 segments", strings.Repeat("a/", 31) + "a"},
{"85 times U+0390 and a letter: 256 UTF-16 units after NFD", strings.Repeat("\u0390", 85) + "a"},
{"42 times U+1D160: 168 bytes, 252 UTF-16 units after NFD", strings.Repeat("\U0001d160", 42)},
{"43 times U+1D160: 172 bytes, 258 UTF-16 units after NFD", strings.Repeat("\U0001d160", 43)},
{"127 times U+00E9 and a letter: 255 bytes", strings.Repeat("\u00e9", 127) + "a"},
{"128 times U+00E9: 256 bytes", strings.Repeat("\u00e9", 128)},
{"63 emoji: 252 bytes, 126 UTF-16 units", strings.Repeat("\U0001f600", 63)},
{"64 emoji: 256 bytes", strings.Repeat("\U0001f600", 64)},
{"a base of nine runes before the tilde", "ABCDEFG~1"},
{"an 8.3 alias with an extension of four", "ABCDEF~1.TEXT"},
{"an 8.3 alias with an astral letter", "\U00010400BCDEF~1"},
{"an 8.3 alias with an astral extension", "ABCDEF~1.\U00010400\U00010401\U00010402"},
{"an astral extension of four", "ABCDEF~1.\U00010400\U00010401\U00010402\U00010403"},
}
var out []stringCase
for _, n := range named {

@ -15,7 +15,8 @@
// tests, edges of the count, every kind of refused code point, and the
// words of the texts of normalize.
// - keys: words, a chain hash, a round and a capsule_id; the salt S of
// §38.1, checked against wordkey.Key; wordkey.Key, 600 000 iterations of
// §38.1, and the password P, the words joined by one U+0020, both
// checked against wordkey.Key; wordkey.Key, 600 000 iterations of
// PBKDF2-HMAC-SHA256; the same PBKDF2 with 1000 iterations, for the tests
// compiled to JavaScript; and the recipient of wordkey.Identity. The
// first is the vector of spec §38.1.
@ -147,6 +148,7 @@ type keyCase struct {
ChainHash string `json:"chain_hash"`
Round uint64 `json:"round"`
CapsuleID string `json:"capsule_id"`
Password string `json:"password"`
Salt string `json:"salt"`
Key string `json:"key"`
Key1000 string `json:"key_1000"`
@ -173,7 +175,7 @@ func keyOf(name string, words []string, chain []byte, round uint64, capsuleID []
if err != nil {
log.Fatal(err)
}
return keyCase{name, hexAll(words), hex.EncodeToString(chain), round, hex.EncodeToString(capsuleID), salt,
return keyCase{name, hexAll(words), hex.EncodeToString(chain), round, hex.EncodeToString(capsuleID), h(strings.Join(words, " ")), salt,
hex.EncodeToString(key), hex.EncodeToString(short), id.Recipient().String()}
}
@ -214,6 +216,9 @@ func normalizeCases() []normalizeCase {
{"the ideographic space", "uno\u3000dos"},
{"line and paragraph separators", "uno\u2028dos\u2029tres"},
{"control characters that are not white space", "uno\x01dos\x7fres"},
{"the first and the last mark of U+0300 to U+036F", "a\u0300b\u036fc"},
{"U+02FF and U+0370, around U+0300 to U+036F", "a\u02ffb\u0370c"},
{"every mark of U+0300 to U+036F", "x\u0300\u0301\u0302\u0303\u0304\u0305\u0306\u0307\u0308\u0309\u030a\u030b\u030c\u030d\u030e\u030f\u0310\u0311\u0312\u0313\u0314\u0315\u0316\u0317\u0318\u0319\u031a\u031b\u031c\u031d\u031e\u031f\u0320\u0321\u0322\u0323\u0324\u0325\u0326\u0327\u0328\u0329\u032a\u032b\u032c\u032d\u032e\u032f\u0330\u0331\u0332\u0333\u0334\u0335\u0336\u0337\u0338\u0339\u033a\u033b\u033c\u033d\u033e\u033f\u0340\u0341\u0342\u0343\u0344\u0345\u0346\u0347\u0348\u0349\u034a\u034b\u034c\u034d\u034e\u034f\u0350\u0351\u0352\u0353\u0354\u0355\u0356\u0357\u0358\u0359\u035a\u035b\u035c\u035d\u035e\u035f\u0360\u0361\u0362\u0363\u0364\u0365\u0366\u0367\u0368\u0369\u036a\u036b\u036c\u036d\u036e\u036fy"},
}
var out []normalizeCase
for _, n := range named {
@ -274,6 +279,12 @@ func checkCases(texts []normalizeCase) []checkCase {
{"refusals before the count", []string{"aaa", "bbb", "c\u00ad"}},
{"empty words", []string{"", "", "aaa", "bbb", "ccc", "ddd", "eee", "fff"}},
{"a word of three spaces given as it is", []string{" ", "bbb", "ccc", "ddd", "eee", "fff"}},
// The edges of the controls of unicode.IsControl, C0 and C1.
{"U+001F is a control", []string{"a\x1fb", "bbb", "ccc", "ddd", "eee", "fff"}},
{"U+007E is not", []string{"a~b", "bbb", "ccc", "ddd", "eee", "fff"}},
{"U+007F is a control", []string{"a\x7fb", "bbb", "ccc", "ddd", "eee", "fff"}},
{"U+0080 is a control", []string{"a\u0080b", "bbb", "ccc", "ddd", "eee", "fff"}},
{"U+00A0 inside a word given as it is is not", []string{"a\u00a0b", "bbb", "ccc", "ddd", "eee", "fff"}},
}
var out []checkCase
for _, n := range named {
@ -391,7 +402,7 @@ func main() {
}{
{"description", "The results of package wordkey of the Go reference (spec \u00a738.1) for lib/src/wordkey.dart; see tool/wordkey_go_vectors.go. " +
"Binary values are lower-case hex. normalize: a text and the words of wordkey.Normalize. check: words and the result of wordkey.Check, ok or the text of the error. " +
"keys: words, chain_hash, round and capsule_id; salt, the salt S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1."},
"keys: words, chain_hash, round and capsule_id; password and salt, P and S of \u00a738.1; key, wordkey.Key; key_1000, the same PBKDF2-HMAC-SHA256 with 1000 iterations; recipient, that of wordkey.Identity. The first key is the vector of \u00a738.1."},
{"generator", "tool/wordkey_go_vectors.go, " + runtime.Version()},
{"rounds", wordkey.Rounds},
{"min_words", wordkey.MinWords},

Loading…
Cancel
Save

Powered by TurnKey Linux.