Add blake2b test vectors.
This commit is contained in:
parent
65b12cddd9
commit
26277f4e90
81
spec/sodium/digest/blake2b-test-vectors.json
Normal file
81
spec/sodium/digest/blake2b-test-vectors.json
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
[
|
||||||
|
{"outlen":64,"out":"786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce","input":"","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"2fa3f686df876995167e7c2e5d74c4c7b6e48f8068fe0e44208344d480f7904c36963e44115fe3eb2a3ac8694c28bcb4f5a0f3276f2e79487d8219057a506e4b","input":"00","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"a8b60fa4fc2442f6f1514ad7402626920cc7c2c9f72124b8cba8ee2cb7c4586f658a4410cffcc0ab88343955e094c6af0d20d0c714fb0a988f543f300f58d389","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"8271cc45dfa5e4170e847e8630b952cf9c2aa777d06f26a7585b8381f188dacc7337391cfcc94b053dc4ec29cc17f077870428f1ac23fddda165ef5a3f155f39","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"710dacb166844639cd7b637c274209424e2449dc35d790bbfa4f76177054a36b3b76fac0ca6e61df1e687000678ac0746df75d0a3954897681fd393a155a1bb4","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f7071","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"c1d5f93b8dea1f2571babccbc01764541a0cda87e444d673c50966ca559c33354b3acb26e5d5781ffb28847a4b4754d77008c62a835835f500dea7c3b58bdae2","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"b6292669ccd38d5f01caae96ba272c76a879a45743afa0725d83b9ebb26665b731f1848c52f11972b6644f554c064fa90780dbbbf3a89d4fc31f67df3e5857ef","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"2319e3789c47e2daa5fe807f61bec2a1a6537fa03f19ff32e87eecbfd64b7e0e8ccff439ac333b040f19b0c4ddd11a61e24ac1fe0f10a039806c5dcc0da3d115","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f","key":"","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"af8e6e91fab46ce4873e1a50a8ef448cc29121f7f74deef34a71ef89cc00d9274bc6c2454bbb3230d8b2ec94c62b1dec85f3593bfa30ea6f7a44d7c09465a253","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeef","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"1085d78307b1c4b008c57a2e7e5b234658a0a82e4ff1e4aaac72b312fda0fe27d233bc5b10e9cc17fdc7697b540c7d95eb215a19a1a0e20e1abfa126efd568c7","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"4e5c734c7dde011d83eac2b7347b373594f92d7091b9ca34cb9c6f39bdf5a8d2f134379e16d822f6522170ccf2ddd55c84b9e6c64fc927ac4cf8dfb2a17701f2","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fa","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"695d83bd990a1117b3d0ce06cc888027d12a054c2677fd82f0d4fbfc93575523e7991a5e35a3752e9b70ce62992e268a877744cdd435f5f130869c9a2074b338","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafb","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"a6213743568e3b3158b9184301f3690847554c68457cb40fc9a4b8cfd8d4a118c301a07737aeda0f929c68913c5f51c80394f53bff1c3e83b2e40ca97eba9e15","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfc","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"d444bfa2362a96df213d070e33fa841f51334e4e76866b8139e8af3bb3398be2dfaddcbc56b9146de9f68118dc5829e74b0c28d7711907b121f9161cb92b69a9","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfd","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen":64,"out":"142709d62e28fcccd0af97fad0f8465b971e82201dc51070faa0372aa43e92484be1c1e73ba10906d5d1853db6a4106e0a7bf9800d373d6dee2d46d62ef2a461","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfe","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"","personal":""},
|
||||||
|
{"outlen": 1,"out": "ba","input":"","key":"00","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 2,"out": "6139","input":"00","key":"0001","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 3,"out": "3a1666","input":"0001","key":"000102","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 4,"out": "5797e9d0","input":"000102","key":"00010203","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 5,"out": "834a26efe6","input":"00010203","key":"0001020304","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 6,"out": "d7e9e862bbce","input":"0001020304","key":"000102030405","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 7,"out": "40d8b84c374750","input":"000102030405","key":"00010203040506","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 8,"out": "276789189244cf04","input":"00010203040506","key":"0001020304050607","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 9,"out": "16f73ffe0673cc9992","input":"0001020304050607","key":"000102030405060708","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 10,"out": "b3835bfaf6eb71d94078","input":"000102030405060708","key":"00010203040506070809","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 11,"out": "8c624e844d34f4a59f34cc","input":"00010203040506070809","key":"000102030405060708090a","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 12,"out": "e0a394962413ad09975df3cf","input":"000102030405060708090a","key":"000102030405060708090a0b","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 13,"out": "47f043c3aacb501f97e0458ae3","input":"000102030405060708090a0b","key":"000102030405060708090a0b0c","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 14,"out": "b4a11f2fb72a7e6f96fdacf98d49","input":"000102030405060708090a0b0c","key":"000102030405060708090a0b0c0d","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 15,"out": "f434079e9adeb244047cb6855f9854","input":"000102030405060708090a0b0c0d","key":"000102030405060708090a0b0c0d0e","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 16,"out": "5fbe885c4b2d4e0d78dc5905622a277a","input":"000102030405060708090a0b0c0d0e","key":"000102030405060708090a0b0c0d0e0f","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 17,"out": "e262ba3e2ab76efdf83513108e3b987d1b","input":"000102030405060708090a0b0c0d0e0f","key":"000102030405060708090a0b0c0d0e0f10","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 18,"out": "add93dde78d32e77bc039c34a49043f19d26","input":"000102030405060708090a0b0c0d0e0f10","key":"000102030405060708090a0b0c0d0e0f1011","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 19,"out": "093842ac10e2eb1237ddc9ca9e7990cf397772","input":"000102030405060708090a0b0c0d0e0f1011","key":"000102030405060708090a0b0c0d0e0f101112","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 20,"out": "09e7f6a0e2ea4888f1dbf6562effd1561c65029c","input":"000102030405060708090a0b0c0d0e0f101112","key":"000102030405060708090a0b0c0d0e0f10111213","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 21,"out": "bd33a9ec914f5b81864a49184338e4062d6c6b2b2e","input":"000102030405060708090a0b0c0d0e0f10111213","key":"000102030405060708090a0b0c0d0e0f1011121314","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 22,"out": "8dc46295235d94f5881d429a5ad47f9db9e35cf8c6b3","input":"000102030405060708090a0b0c0d0e0f1011121314","key":"000102030405060708090a0b0c0d0e0f101112131415","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 23,"out": "ba5df554dca7ac1cba4889fa88adf3070fbf4ab5d187b5","input":"000102030405060708090a0b0c0d0e0f101112131415","key":"000102030405060708090a0b0c0d0e0f10111213141516","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 24,"out": "1ff84715e71c66214d271d421395fb6166db97b1d47ed697","input":"000102030405060708090a0b0c0d0e0f10111213141516","key":"000102030405060708090a0b0c0d0e0f1011121314151617","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 25,"out": "75a0d227c70549f5b0c933b7b21f151355bd47e04b6085c91f","input":"000102030405060708090a0b0c0d0e0f1011121314151617","key":"000102030405060708090a0b0c0d0e0f101112131415161718","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 26,"out": "a32a5c9439a0fa771dcbe7f338b5dcef62a754edc4952614d6f0","input":"000102030405060708090a0b0c0d0e0f101112131415161718","key":"000102030405060708090a0b0c0d0e0f10111213141516171819","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 27,"out": "53a87de519cdcc7f64730d58bce6baaf7b44c5c428a4611a208ad4","input":"000102030405060708090a0b0c0d0e0f10111213141516171819","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 28,"out": "5e5ad8f0c4f083f9b7a5154d9c0dfd0f3d2fce94cf54fc215450314a","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 29,"out": "9c76b9e63c77e6564b1e5111c2fb140046e1e5a4f900a7cfc2bac3fcfa","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 30,"out": "bb919251ca310eb9b994e5d7883bc9fa2144b59b8d5d940677b7130ac777","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 31,"out": "faa492a66f08ef0c7adb868fcb7b523aedd35b8ff1414bd1d554794f144474","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 32,"out": "9b273ebe335540b87be899abe169389ed61ed262c3a0a16e4998bbf752f0bee3","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 33,"out": "1e0070b92429c151b33bdd1bb4430a0e650a3dfc94d404054e93c8568330ecc505","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 34,"out": "e3b64149f1b76231686d592d1d4af984ce2826ba03c2224a92f95f9526130ce4eb40","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 35,"out": "5f8e378120b73db9eefa65ddcdcdcb4acd8046c31a5e47f298caa400937d5623f1394b","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 36,"out": "74c757a4165a1782c933e587353a9fd8f6d7bf26b7f51b52c542747030bfb3d560c2e5c2","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 37,"out": "2d5ee85cc238b923806dd98db18919d1924f2340ec88917d4ce1799cbfd5f2cb9df99db2e1","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 38,"out": "c93ff727e6f9822efec0a77eed0025c0eff19127bf8746b7c71c2a098f57cef02febb86a1e6c","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 39,"out": "adfb6d7ba13779a5dd1bbf268e400f4156f0f5c9d5b670ff539e1d9c1a63373416f3001f338407","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 40,"out": "3a6900e58a448887d77c5911e4bdde620e64f25b2d71723fa60f7cb3efa7c320b6153bdbc3287949","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 41,"out": "413eb0fd379b32dd88e82242a87cc58ce3e64c72352387a4c70f92ee5c8d23fa7ecd86f6df170a32d2","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 42,"out": "92d0d3cacc3e25628caf6f2c4cd50d25d154ac45098f531d690230b859f37cfe089eb169f76bba72a3ff","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526272829","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 43,"out": "92f6ccc11a9a3bee520b17e0cddc4550c0e9cf47ddd9a6161284259ffb161c1d0675b505cb1066872768e8","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526272829","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 44,"out": "a3cd675804e6be7f120138a9eaadcd56bb7763d1c046e87fe0d358c8276b0d24621f46c60b46e397933b75b4","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 45,"out": "304a1af53cbdd6486b8419d1ebd5e9528c540d8dc46a10be49067f46a0617229577015d776783f702b2954df43","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 46,"out": "d8a6358970446453ac0c82c758644ab68989b5b4f06f9768807ce0c5f2a0dbac1e8450f4e3a02deecf7b54b6a45d","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 47,"out": "1264b8dee9ac4aa8de69a43ada95cc95f20230f33836d4a1db8c2466ab38361686e5ac282025ccc2e0f6a1cd98a4dd","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 48,"out": "7eed787abaa7f4e8b8aa3090f0676201cfbaaf350899661cdd5216ac0b5cd874443f5c0688ffd7ca1ccbfe1ca7e1a3f5","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 49,"out": "8907f0218585167962a8e8213559a643dd03c2bf1a7a5ad3e3bc5f88c0ff1532ee8cd29880e7e0e68da22a5798aef27cc5","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 50,"out": "12dea17b0733e5060751b1115e10c3d4b2f4583bcd009d9f1f42ec23d4a6a0df1185d3abbdbe86de08569e70583d6de1c1fe","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 51,"out": "8ff75e91f1de547dc3a25472db2f51f5910a290c449603da54207b5e39bd735d240ec913b52df90709b5d29357971d6c341452","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 52,"out": "4a3b16b12400f38e74778efc3a4caa52ec6fdf6b0180a5bfac9189e52e162c10e8911a54ab33e2b389ee1949e58edaa119e2b2b9","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 53,"out": "c9943e7186fdc9bbfa1d7087fa7086babe6fcf95a6196d1772187854071304e2f1fff39e6e6f48f76addb16d5c00249e0523aac91f","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 54,"out": "0297f16fdd34add9cc87b4adf816525b590ba08ac733c43f8d225d194df4f9c83b4dce617be51e25b5f6c80dff249f27c707de20e422","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 55,"out": "576bb891eab9930998e2e73b5d0498e3c5f040f8dec9397a8c7a622c17de01fee7cc936e3bd4de1f7fd8b31dea9e70c65462bbb5dc7b50","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 56,"out": "9416a57ae7c8c51c6e008f940fe06d8ebc02c350c19a2f71583a6d260b085670d73a95248fef0f4cae5292ba7db1189a7cd9c51122ba7913","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 57,"out": "ea644b9051cca5eee8868a553e3f0f4e14739e1555474151156e10578256b288a233870dd43a380765400ea446df7f452c1e03a9e5b6731256","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 58,"out": "f99cc1603de221abc1ecb1a7eb4bbf06e99561d1cc5541d8d601bae2b1dd3cbe448ac276667f26de5e269183a09f7deaf35d33174b3cc8ad4aa2","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536373839","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 59,"out": "ee2be1ec57fdac23f89402a534177eca0f4b982a4ed2c2e900b6a79e1f47a2d023eff2e647baf4f4c0da3a28d08a44bc780516974074e2523e6651","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536373839","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 60,"out": "9cda001868949a2bad96c5b3950a8315e6e5214d0b54dcd596280565d351806ef22cf3053f63623da72fcad9afa3896641658632334c9ec4f644c984","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 61,"out": "c6d6722a916651a8671383d8260873347d9c248696b4cb3dac4dea9ba57ed971127cb18e44211d7e14177ace248b3c6e0785356ee261ebdc6ef0faf143","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 62,"out": "5dd258a3e7505bc6b9776b0df25676a1c19e2c8258c7b5f2e361423523d96299eb6827bc7c27e7bca2d2b59d717c2ebcb05e6dcaa32289d96fae9a4077ef","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 63,"out": "19c14de35fe19c92cc0e624280e4136355d4cfa9a0a98b090c4b06f5665021920725852ff1f566b0c8c37157b25fb9f947a2e70b40577a17860a0732c170ac","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"},
|
||||||
|
{"outlen": 64,"out": "5fcdcc02be7714a0dbc77df498bf999ea9225d564adca1c121c9af03af92cac8177b9b4a86bcc47c79aa32aac58a3fef967b2132e9352d4613fe890beed2571b","input":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e","key":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f","salt":"35623662343165643962333433666530","personal":"35313236666232613337343030643261"}
|
||||||
|
]
|
@ -1,15 +1,7 @@
|
|||||||
require "../../spec_helper"
|
require "../../spec_helper"
|
||||||
|
require "json"
|
||||||
|
|
||||||
libsodium_comparisons = [
|
# From https://github.com/BLAKE2/BLAKE2/tree/master/testvectors
|
||||||
{
|
|
||||||
key: nil,
|
|
||||||
input: "",
|
|
||||||
output: "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8",
|
|
||||||
out_size: 32,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
# from https://github.com/BLAKE2/BLAKE2/tree/master/testvectors
|
|
||||||
test_vectors = [
|
test_vectors = [
|
||||||
{
|
{
|
||||||
key: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
|
key: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
|
||||||
@ -23,6 +15,19 @@ test_vectors = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# From https://github.com/emilbayes/blake2b/blob/master/test-vectors.json
|
||||||
|
buf = File.read(Path[__DIR__].join("blake2b-test-vectors.json").to_s)
|
||||||
|
more_vectors = Array(Hash(String, String | Int32)).from_json(buf).map do |h|
|
||||||
|
{
|
||||||
|
input: h["input"].to_s,
|
||||||
|
output: h["out"].to_s,
|
||||||
|
out_len: h["outlen"].to_i,
|
||||||
|
key: h["key"].to_s,
|
||||||
|
salt: h["salt"].to_s,
|
||||||
|
personal: h["personal"].to_s,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe Sodium::Digest::Blake2b do
|
describe Sodium::Digest::Blake2b do
|
||||||
it "libsodium comparisons" do
|
it "libsodium comparisons" do
|
||||||
libsodium_comparisons.each do |vec|
|
libsodium_comparisons.each do |vec|
|
||||||
@ -38,6 +43,14 @@ describe Sodium::Digest::Blake2b do
|
|||||||
d.update vec[:input].hexbytes
|
d.update vec[:input].hexbytes
|
||||||
d.hexdigest.should eq vec[:output]
|
d.hexdigest.should eq vec[:output]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
more_vectors.each do |vec|
|
||||||
|
salt = vec[:salt].empty? ? nil : vec[:salt].hexbytes
|
||||||
|
personal = vec[:personal].empty? ? nil : vec[:personal].hexbytes
|
||||||
|
d = Sodium::Digest::Blake2b.new vec[:out_len], key: vec[:key].hexbytes, salt: salt, personal: personal
|
||||||
|
d.update vec[:input].hexbytes
|
||||||
|
d.hexdigest.should eq vec[:output]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "produces different output with different salt or personal params" do
|
it "produces different output with different salt or personal params" do
|
||||||
|
@ -7,12 +7,12 @@ module Sodium
|
|||||||
# If you don't want this behavior pass a duplicate of the key/seed to initialize().
|
# If you don't want this behavior pass a duplicate of the key/seed to initialize().
|
||||||
#
|
#
|
||||||
# ```crystal
|
# ```crystal
|
||||||
# key = Sodium::SecretKey.new
|
# key = Sodium::SecretBox.new
|
||||||
# message = "foobar"
|
# message = "foobar"
|
||||||
# encrypted, nonce = key.encrypt_easy message
|
# encrypted, nonce = key.encrypt_easy message
|
||||||
#
|
#
|
||||||
# # On the other side.
|
# # On the other side.
|
||||||
# key = Sodium::SecretKey.new key
|
# key = Sodium::SecretBox.new key
|
||||||
# message = key.decrypt_easy encrypted, nonce
|
# message = key.decrypt_easy encrypted, nonce
|
||||||
# ```
|
# ```
|
||||||
class SecretBox < Key
|
class SecretBox < Key
|
||||||
|
@ -15,16 +15,16 @@ module Sodium::Wipe
|
|||||||
|
|
||||||
{% for ivar in @type.instance_vars %}
|
{% for ivar in @type.instance_vars %}
|
||||||
{% if ann = ivar.annotation(Wipe::Var) %}
|
{% if ann = ivar.annotation(Wipe::Var) %}
|
||||||
{% if ivar.type.id == StaticArray.id %}
|
|
||||||
#puts "wiping static {{ivar}}"
|
|
||||||
# Sodium.memzero @{{ ivar.id }}.to_slice
|
|
||||||
{% else %}
|
|
||||||
if var = @{{ ivar.id }}
|
if var = @{{ ivar.id }}
|
||||||
|
case var
|
||||||
|
when StaticArray
|
||||||
#puts "wiping {{ivar}}"
|
#puts "wiping {{ivar}}"
|
||||||
# Sodium.memzero var
|
# Sodium.memzero var.to_slice
|
||||||
|
# @{{ ivar.id }} = var
|
||||||
|
else
|
||||||
Sodium.memzero var.to_slice
|
Sodium.memzero var.to_slice
|
||||||
end
|
end
|
||||||
{% end %}
|
end
|
||||||
{% end %}
|
{% end %}
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user