argon2_vectors.js (2054B)
1 function getTestData() { 2 // Test vectors from RFC 9106 3 // https://www.rfc-editor.org/rfc/rfc9106 4 5 // Test vectors from RFC 9106 6 var testVectors = [ 7 // Argon2d test vector 8 { 9 algorithm: 'Argon2d', 10 password: new Uint8Array(32).fill(0x01), 11 params: { 12 memory: 32, 13 passes: 3, 14 parallelism: 4, 15 nonce: new Uint8Array(16).fill(0x02), 16 secretValue: new Uint8Array(8).fill(0x03), 17 associatedData: new Uint8Array(12).fill(0x04), 18 }, 19 expected: new Uint8Array([ 20 0x51, 0x2b, 0x39, 0x1b, 0x6f, 0x11, 0x62, 0x97, 0x53, 0x71, 0xd3, 0x09, 21 0x19, 0x73, 0x42, 0x94, 0xf8, 0x68, 0xe3, 0xbe, 0x39, 0x84, 0xf3, 0xc1, 22 0xa1, 0x3a, 0x4d, 0xb9, 0xfa, 0xbe, 0x4a, 0xcb, 23 ]), 24 }, 25 // Argon2i test vector 26 { 27 algorithm: 'Argon2i', 28 password: new Uint8Array(32).fill(0x01), 29 params: { 30 memory: 32, 31 passes: 3, 32 parallelism: 4, 33 nonce: new Uint8Array(16).fill(0x02), 34 secretValue: new Uint8Array(8).fill(0x03), 35 associatedData: new Uint8Array(12).fill(0x04), 36 }, 37 expected: new Uint8Array([ 38 0xc8, 0x14, 0xd9, 0xd1, 0xdc, 0x7f, 0x37, 0xaa, 0x13, 0xf0, 0xd7, 0x7f, 39 0x24, 0x94, 0xbd, 0xa1, 0xc8, 0xde, 0x6b, 0x01, 0x6d, 0xd3, 0x88, 0xd2, 40 0x99, 0x52, 0xa4, 0xc4, 0x67, 0x2b, 0x6c, 0xe8, 41 ]), 42 }, 43 // Argon2id test vector 44 { 45 algorithm: 'Argon2id', 46 password: new Uint8Array(32).fill(0x01), 47 params: { 48 memory: 32, 49 passes: 3, 50 parallelism: 4, 51 nonce: new Uint8Array(16).fill(0x02), 52 secretValue: new Uint8Array(8).fill(0x03), 53 associatedData: new Uint8Array(12).fill(0x04), 54 }, 55 expected: new Uint8Array([ 56 0x0d, 0x64, 0x0d, 0xf5, 0x8d, 0x78, 0x76, 0x6c, 0x08, 0xc0, 0x37, 0xa3, 57 0x4a, 0x8b, 0x53, 0xc9, 0xd0, 0x1e, 0xf0, 0x45, 0x2d, 0x75, 0xb6, 0x5e, 58 0xb5, 0x25, 0x20, 0xe9, 0x6b, 0x01, 0xe6, 0x59, 59 ]), 60 }, 61 ]; 62 63 return { 64 testVectors: testVectors, 65 }; 66 }