mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-24 15:34:10 +03:00
Merge branch 'lukechampine/crypto-tests' (#2222)
* lukechampine/crypto-tests: test: add bip32 vectors test: add scrypt vectors test: add hmac vectors test: add ed25519 vectors test: add expect arm test: add AES SIV mode vectors zuse: split sivb keys at correct offset test: add AES-CMAC vectors test: add AES CTR mode vectors test: add AES CBC mode vectors test: add AES ECB mode vectors
This commit is contained in:
commit
9c1d3090c9
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:684effe62df5848c6af7d148ca7d2e88ede02d534f1e30fa255e11bfbc12c4e1
|
||||
size 9658892
|
||||
oid sha256:f887b67ad8c784c7d56c724207e4beb6940bf2b18b70a2af39f10f2739d2a388
|
||||
size 9702258
|
||||
|
@ -212,5 +212,5 @@
|
||||
::
|
||||
++ hash160
|
||||
|= d=@
|
||||
(ripemd-160:ripemd:crypto 256 (sha-256:sha d))
|
||||
(ripemd-160:ripemd:crypto 32 (sha-256:sha d))
|
||||
--
|
||||
|
@ -25,6 +25,11 @@
|
||||
(~(dunk ut p.expected) %expected)
|
||||
== ==
|
||||
result
|
||||
:: +expect: compares :actual to %.y and pretty-prints anything else
|
||||
::
|
||||
++ expect
|
||||
|= actual=vase
|
||||
(expect-eq !>(%.y) actual)
|
||||
:: +expect-fail: kicks a trap, expecting crash. pretty-prints if succeeds
|
||||
::
|
||||
++ expect-fail
|
||||
|
@ -3357,7 +3357,7 @@
|
||||
~/ %en
|
||||
|= txt/@
|
||||
^- (trel @uxH @ud @ux)
|
||||
=+ [k1=(rsh 5 3 key) k2=(end 5 3 key)]
|
||||
=+ [k1=(rsh 6 3 key) k2=(end 6 3 key)]
|
||||
=+ iv=(s2vb k1 (weld vec (limo ~[txt])))
|
||||
=* hib (dis iv 0xffff.ffff.ffff.ffff.7fff.ffff.7fff.ffff)
|
||||
=+ len=(met 3 txt)
|
||||
@ -3369,7 +3369,7 @@
|
||||
~/ %de
|
||||
|= {iv/@H len/@ txt/@}
|
||||
^- (unit @ux)
|
||||
=+ [k1=(rsh 5 3 key) k2=(end 5 3 key)]
|
||||
=+ [k1=(rsh 6 3 key) k2=(end 6 3 key)]
|
||||
=* hib (dis iv 0xffff.ffff.ffff.ffff.7fff.ffff.7fff.ffff)
|
||||
=+ ^= pln
|
||||
(~(de ctrb k2 7 len hib) txt)
|
||||
|
168
pkg/arvo/tests/lib/bip32.hoon
Normal file
168
pkg/arvo/tests/lib/bip32.hoon
Normal file
@ -0,0 +1,168 @@
|
||||
:: tests for the bip32 lib
|
||||
::
|
||||
:: Test vectors from:
|
||||
:: https://en.bitcoin.it/wiki/BIP_0032_TestVectors
|
||||
::
|
||||
/+ *test, bip32
|
||||
=, bip32
|
||||
::
|
||||
|%
|
||||
+$ vector [mk=byts dp=tape id=@ux sk=@ux pk=@ux cc=@ux]
|
||||
::
|
||||
++ test-vectors
|
||||
^- tang
|
||||
|^ ;: weld
|
||||
%+ category "identity"
|
||||
(zing (turn vectors check-id))
|
||||
%+ category "public-key"
|
||||
(zing (turn vectors check-pk))
|
||||
%+ category "private-key"
|
||||
(zing (turn vectors check-sk))
|
||||
%+ category "chaincode"
|
||||
(zing (turn vectors check-cc))
|
||||
==
|
||||
::
|
||||
++ check-id
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> id
|
||||
!> `@ux`identity:(derive-path:(from-seed mk) dp)
|
||||
::
|
||||
++ check-pk
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> pk
|
||||
!> `@ux`public-key:(derive-path:(from-seed mk) dp)
|
||||
::
|
||||
++ check-sk
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> sk
|
||||
!> `@ux`private-key:(derive-path:(from-seed mk) dp)
|
||||
::
|
||||
++ check-cc
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> cc
|
||||
!> `@ux`chain-code:(derive-path:(from-seed mk) dp)
|
||||
::
|
||||
++ vectors
|
||||
^- (list vector)
|
||||
:~
|
||||
:*
|
||||
16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
"m/0'"
|
||||
0x5c1b.d648.ed23.aa5f.d50b.a52b.2457.c11e.9e80.a6a7
|
||||
0xedb2.e14f.9ee7.7d26.dd93.b4ec.ede8.d16e.d408.ce14.9b6c.d80b.0715.a2d9.11a0.afea
|
||||
0x3.5a78.4662.a4a2.0a65.bf6a.ab9a.e98a.6c06.8a81.c52e.4b03.2c0f.b540.0c70.6cfc.cc56
|
||||
0x47fd.acbd.0f10.9704.3b78.c63c.20c3.4ef4.ed9a.111d.9800.47ad.1628.2c7a.e623.6141
|
||||
==
|
||||
::
|
||||
:*
|
||||
16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
"m/0'/1"
|
||||
0xbef5.a2f9.a56a.94aa.b124.59f7.2ad9.cf8c.f19c.7bbe
|
||||
0x3c6c.b8d0.f6a2.64c9.1ea8.b503.0fad.aa8e.538b.020f.0a38.7421.a12d.e931.9dc9.3368
|
||||
0x3.501e.454b.f007.51f2.4b1b.489a.a925.215d.66af.2234.e389.1c3b.21a5.2bed.b3cd.711c
|
||||
0x2a78.5763.1386.ba23.daca.c341.80dd.1983.734e.444f.dbf7.7404.1578.e9b6.adb3.7c19
|
||||
==
|
||||
::
|
||||
:*
|
||||
16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
"m/0'/1/2'"
|
||||
0xee7a.b90c.de56.a8c0.e2bb.086a.c497.48b8.db9d.ce72
|
||||
0xcbce.0d71.9ecf.7431.d88e.6a89.fa14.83e0.2e35.092a.f60c.042b.1df2.ff59.fa42.4dca
|
||||
0x3.57bf.e1e3.41d0.1c69.fe56.5430.9956.cbea.5168.22fb.a8a6.0174.3a01.2a78.96ee.8dc2
|
||||
0x446.6b9c.c8e1.61e9.6640.9ca5.2986.c584.f07e.9dc8.1f73.5db6.83c3.ff6e.c7b1.503f
|
||||
==
|
||||
::
|
||||
:*
|
||||
16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
"m/0'/1/2'/2"
|
||||
0xd880.d7d8.9384.8509.a62d.8fb7.4e32.148d.ac68.412f
|
||||
0xf47.9245.fb19.a38a.1954.c5c7.c0eb.ab2f.9bdf.d96a.1756.3ef2.8a6a.4b1a.2a76.4ef4
|
||||
0x2.e844.5082.a72f.29b7.5ca4.8748.a914.df60.622a.609c.acfc.e8ed.0e35.8045.6074.1d29
|
||||
0xcfb7.1883.f016.76f5.87d0.23cc.53a3.5bc7.f88f.724b.1f8c.2892.ac12.75ac.822a.3edd
|
||||
==
|
||||
::
|
||||
:*
|
||||
16^0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
"m/0'/1/2'/2/1000000000"
|
||||
0xd69a.a102.255f.ed74.3782.78c7.8127.01ea.641f.df32
|
||||
0x471b.76e3.89e5.28d6.de6d.8168.57e0.12c5.4550.51ca.d666.0850.e583.72a6.c3e6.e7c8
|
||||
0x2.2a47.1424.da5e.6574.99d1.ff51.cb43.c474.81a0.3b1e.77f9.51fe.64ce.c9f5.a48f.7011
|
||||
0xc783.e67b.921d.2beb.8f6b.389c.c646.d726.3b41.4570.1dad.d216.1548.a8b0.78e6.5e9e
|
||||
==
|
||||
::
|
||||
:*
|
||||
64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2.
|
||||
cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.
|
||||
9f9c.9996.9390.8d8a.8784.817e.7b78.7572.
|
||||
6f6c.6966.6360.5d5a.5754.514e.4b48.4542
|
||||
"m/0"
|
||||
0x5a61.ff8e.b7aa.ca30.10db.97eb.da76.1216.10b7.8096
|
||||
0xabe7.4a98.f6c7.eabe.e042.8f53.798f.0ab8.
|
||||
aa1b.d378.7399.9041.703c.742f.15ac.7e1e
|
||||
0x2.fc9e.5af0.ac8d.9b3c.ecfe.2a88.8e21.17ba.
|
||||
3d08.9d85.8588.6c9c.826b.6b22.a98d.12ea
|
||||
0xf090.9aff.aa7e.e7ab.e5dd.4e10.0598.d4dc.53cd.709d.5a5c.2cac.40e7.412f.232f.7c9c
|
||||
==
|
||||
::
|
||||
:*
|
||||
64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2.
|
||||
cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.
|
||||
9f9c.9996.9390.8d8a.8784.817e.7b78.7572.
|
||||
6f6c.6966.6360.5d5a.5754.514e.4b48.4542
|
||||
"m/0/2147483647'"
|
||||
0xd8ab.4937.36da.02f1.1ed6.82f8.8339.e720.fb03.79d1
|
||||
0x877c.779a.d968.7164.e9c2.f4f0.f4ff.0340.
|
||||
8143.9233.0693.ce95.a58f.e18f.d52e.6e93
|
||||
0x3.c01e.7425.647b.defa.82b1.2d9b.ad5e.3e68.
|
||||
65be.e050.2694.b94c.a58b.666a.bc0a.5c3b
|
||||
0xbe17.a268.474a.6bb9.c61e.1d72.0cf6.215e.2a88.c540.6c4a.ee7b.3854.7f58.5c9a.37d9
|
||||
==
|
||||
::
|
||||
:*
|
||||
64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2.
|
||||
cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.
|
||||
9f9c.9996.9390.8d8a.8784.817e.7b78.7572.
|
||||
6f6c.6966.6360.5d5a.5754.514e.4b48.4542
|
||||
"m/0/2147483647'/1"
|
||||
0x7841.2e3a.2296.a40d.e124.307b.6485.bd19.833e.2e34
|
||||
0x704a.ddf5.44a0.6e5e.e4be.a370.9846.3c23.
|
||||
613d.a320.20d6.0450.6da8.c051.8e1d.a4b7
|
||||
0x3.a7d1.d856.deb7.4c50.8e05.031f.9895.dab5.
|
||||
4626.251b.3806.e16b.4bd1.2e78.1a7d.f5b9
|
||||
0xf366.f48f.1ea9.f2d1.d3fe.958c.95ca.84ea.18e4.c4dd.b936.6c33.6c92.7eb2.46fb.38cb
|
||||
==
|
||||
::
|
||||
:*
|
||||
64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2.
|
||||
cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.
|
||||
9f9c.9996.9390.8d8a.8784.817e.7b78.7572.
|
||||
6f6c.6966.6360.5d5a.5754.514e.4b48.4542
|
||||
"m/0/2147483647'/1/2147483646'"
|
||||
0x31a5.07b8.1559.3dfc.51ff.c724.5ae7.e5ae.e304.246e
|
||||
0xf1c7.c871.a54a.804a.fe32.8b4c.83a1.c33b.
|
||||
8e5f.f48f.5087.273f.04ef.a83b.247d.6a2d
|
||||
0x2.d2b3.6900.396c.9282.fa14.6285.6658.2f20.
|
||||
6a5d.d0bc.c8d5.e892.6118.06ca.fb03.01f0
|
||||
0x6378.0703.0d55.d01f.9a0c.b3a7.8395.15d7.96bd.0770.6386.a6ed.df06.cc29.a65a.0e29
|
||||
==
|
||||
::
|
||||
:*
|
||||
64^0xfffc.f9f6.f3f0.edea.e7e4.e1de.dbd8.d5d2.
|
||||
cfcc.c9c6.c3c0.bdba.b7b4.b1ae.aba8.a5a2.
|
||||
9f9c.9996.9390.8d8a.8784.817e.7b78.7572.
|
||||
6f6c.6966.6360.5d5a.5754.514e.4b48.4542
|
||||
"m/0/2147483647'/1/2147483646'/2"
|
||||
0x2613.2fdb.e7bf.89cb.c64c.f8da.fa3f.9f88.b866.6220
|
||||
0xbb7d.39bd.b83e.cf58.f2fd.82b6.d918.341c.
|
||||
bef4.2866.1ef0.1ab9.7c28.a484.2125.ac23
|
||||
0x2.4d90.2e1a.2fc7.a875.5ab5.b694.c575.fce7.
|
||||
42c4.8d9f.f192.e63d.f519.3e4c.7afe.1f9c
|
||||
0x9452.b549.be8c.ea3e.cb7a.84be.c10d.cfd9.4afe.4d12.9ebf.d3b3.cb58.eedf.394e.d271
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
670
pkg/arvo/tests/sys/zuse/crypto/aes.hoon
Normal file
670
pkg/arvo/tests/sys/zuse/crypto/aes.hoon
Normal file
@ -0,0 +1,670 @@
|
||||
:: tests for the aes block cipher
|
||||
::
|
||||
/+ *test
|
||||
=, aes:crypto
|
||||
::
|
||||
|%
|
||||
::
|
||||
:: ECB mode. Test vectors from Appendix C of FIPS-197:
|
||||
:: https://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||
::
|
||||
+$ vector-ecb [key=@ux in=@ux out=@ux]
|
||||
::
|
||||
++ do-test-vectors-ecb
|
||||
|* [ecbx=_ecba ves=(list vector-ecb)]
|
||||
^- tang
|
||||
|^ %+ weld
|
||||
%+ category "encrypting"
|
||||
(zing (turn ves enc))
|
||||
%+ category "decrypting"
|
||||
(zing (turn ves dec))
|
||||
::
|
||||
++ enc
|
||||
|= vector-ecb
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> `@ux`(~(en ecbx key) in)
|
||||
::
|
||||
++ dec
|
||||
|= vector-ecb
|
||||
%+ expect-eq
|
||||
!> in
|
||||
!> `@ux`(~(de ecbx key) out)
|
||||
--
|
||||
::
|
||||
++ test-aes-ecba
|
||||
%+ do-test-vectors-ecb ecba
|
||||
:~
|
||||
:+ 0x0
|
||||
0x0
|
||||
0x66e9.4bd4.ef8a.2c3b.884c.fa59.ca34.2b2e
|
||||
::
|
||||
:+ 0x0
|
||||
0x1
|
||||
0x58e2.fcce.fa7e.3061.367f.1d57.a4e7.455a
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
0x11.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
0x69c4.e0d8.6a7b.0430.d8cd.b780.70b4.c55a
|
||||
==
|
||||
::
|
||||
++ test-aes-ecbb
|
||||
%+ do-test-vectors-ecb ecbb
|
||||
:~
|
||||
:+ 0x0
|
||||
0x0
|
||||
0xaae0.6992.acbf.52a3.e8f4.a96e.c930.0bd7
|
||||
::
|
||||
:+ 0x0
|
||||
0x1
|
||||
0xcd33.b28a.c773.f74b.a00e.d1f3.1257.2435
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f.
|
||||
1011.1213.1415.1617
|
||||
0x11.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
0xdda9.7ca4.864c.dfe0.6eaf.70a0.ec0d.7191
|
||||
==
|
||||
::
|
||||
++ test-aes-ecbc
|
||||
%+ do-test-vectors-ecb ecbc
|
||||
:~
|
||||
:+ 0x0
|
||||
0x0
|
||||
0xdc95.c078.a240.8989.ad48.a214.9284.2087
|
||||
::
|
||||
:+ 0x0
|
||||
0x1
|
||||
0x530f.8afb.c745.36b9.a963.b4f1.c4cb.738b
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f.
|
||||
1011.1213.1415.1617.1819.1a1b.1c1d.1e1f
|
||||
0x11.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
0x8ea2.b7ca.5167.45bf.eafc.4990.4b49.6089
|
||||
==
|
||||
::
|
||||
:: CBC mode. Test vectors from Appendix F of NIST SP 800-38A:
|
||||
:: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf
|
||||
::
|
||||
+$ vector-cbc [key=@ux iv=@ux in=@ux out=@ux]
|
||||
::
|
||||
++ do-test-vectors-cbc
|
||||
|* [cbcx=_cbca ves=(list vector-cbc)]
|
||||
^- tang
|
||||
|^ %+ weld
|
||||
%+ category "encrypting"
|
||||
(zing (turn ves enc))
|
||||
%+ category "decrypting"
|
||||
(zing (turn ves dec))
|
||||
::
|
||||
++ enc
|
||||
|= vector-cbc
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> `@ux`(~(en cbcx key iv) in)
|
||||
::
|
||||
++ dec
|
||||
|= vector-cbc
|
||||
%+ expect-eq
|
||||
!> in
|
||||
!> `@ux`(~(de cbcx key iv) out)
|
||||
--
|
||||
::
|
||||
++ test-aes-cbca
|
||||
%+ do-test-vectors-cbc cbca
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0xf795.aaab.494b.5923.f7fd.89ff.948b.c1e0
|
||||
::
|
||||
:^ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x7649.abac.8119.b246.cee9.8e9b.12e9.197d.
|
||||
5086.cb9b.5072.19ee.95db.113a.9176.78b2.
|
||||
73be.d6b8.e3c1.743b.7116.e69e.2222.9516.
|
||||
3ff1.caa1.681f.ac09.120e.ca30.7586.e1a7
|
||||
==
|
||||
++ test-aes-cbcb
|
||||
%+ do-test-vectors-cbc cbcb
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0x2a34.93e6.6235.ee67.deec.cd2f.3b39.3bd8
|
||||
::
|
||||
:^ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x4f02.1db2.43bc.633d.7178.183a.9fa0.71e8.
|
||||
b4d9.ada9.ad7d.edf4.e5e7.3876.3f69.145a.
|
||||
571b.2420.12fb.7ae0.7fa9.baac.3df1.02e0.
|
||||
08b0.e279.8859.8881.d920.a9e6.4f56.15cd
|
||||
==
|
||||
++ test-aes-cbcc
|
||||
%+ do-test-vectors-cbc cbcc
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0x7260.03ca.37a6.2a74.d1a2.f58e.7506.358e
|
||||
::
|
||||
:^ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0xf58c.4c04.d6e5.f1ba.779e.abfb.5f7b.fbd6.
|
||||
9cfc.4e96.7edb.808d.679f.777b.c670.2c7d.
|
||||
39f2.3369.a9d9.bacf.a530.e263.0423.1461.
|
||||
b2eb.05e2.c39b.e9fc.da6c.1907.8c6a.9d1b
|
||||
==
|
||||
::
|
||||
:: CTR mode. Test vectors from Appendix F of NIST SP 800-38A:
|
||||
:: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf
|
||||
::
|
||||
+$ vector-ctr [key=@ux iv=@ux in=@ux out=@ux]
|
||||
::
|
||||
++ do-test-vectors-ctr
|
||||
|* [ctrx=_ctra ves=(list vector-ctr)]
|
||||
^- tang
|
||||
|^ %+ weld
|
||||
%+ category "encrypting"
|
||||
(zing (turn ves enc))
|
||||
%+ category "decrypting"
|
||||
(zing (turn ves dec))
|
||||
::
|
||||
++ enc
|
||||
|= vector-ctr
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> `@ux`(~(en ctrx key 7 (met 3 out) iv) in)
|
||||
::
|
||||
++ dec
|
||||
|= vector-ctr
|
||||
%+ expect-eq
|
||||
!> in
|
||||
!> `@ux`(~(de ctrx key 7 (met 3 out) iv) out)
|
||||
--
|
||||
::
|
||||
++ test-aes-ctra
|
||||
%+ do-test-vectors-ctr ctra
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0x58e2.fcce.fa7e.3061.367f.1d57.a4e7.4558
|
||||
::
|
||||
:^ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0xf0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x874d.6191.b620.e326.1bef.6864.990d.b6ce.
|
||||
9806.f66b.7970.fdff.8617.187b.b9ff.fdff.
|
||||
5ae4.df3e.dbd5.d35e.5b4f.0902.0db0.3eab.
|
||||
1e03.1dda.2fbe.03d1.7921.70a0.f300.9cee
|
||||
==
|
||||
++ test-aes-ctrb
|
||||
%+ do-test-vectors-ctr ctrb
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0xcd33.b28a.c773.f74b.a00e.d1f3.1257.2437
|
||||
::
|
||||
:^ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0xf0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x1abc.9324.1752.1ca2.4f2b.0459.fe7e.6e0b.
|
||||
0903.39ec.0aa6.faef.d5cc.c2c6.f4ce.8e94.
|
||||
1e36.b26b.d1eb.c670.d1bd.1d66.5620.abf7.
|
||||
4f78.a7f6.d298.0958.5a97.daec.58c6.b050
|
||||
==
|
||||
++ test-aes-ctrc
|
||||
%+ do-test-vectors-ctr ctrc
|
||||
:~
|
||||
:^ 0x0
|
||||
0x1
|
||||
0x2
|
||||
0x530f.8afb.c745.36b9.a963.b4f1.c4cb.7389
|
||||
::
|
||||
:^ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0xf0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x601e.c313.7757.89a5.b7a7.f504.bbf3.d228.
|
||||
f443.e3ca.4d62.b59a.ca84.e990.caca.f5c5.
|
||||
2b09.30da.a23d.e94c.e870.17ba.2d84.988d.
|
||||
dfc9.c58d.b67a.ada6.13c2.dd08.4579.41a6
|
||||
==
|
||||
::
|
||||
:: AES-CMAC. Test vectors from Section D of NIST SP 800-38B:
|
||||
:: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38b.pdf
|
||||
::
|
||||
+$ vector-mac [key=@ux in=@ux out=@ux]
|
||||
::
|
||||
++ do-test-vectors-mac
|
||||
|* [macx=_maca ves=(list vector-mac)]
|
||||
^- tang
|
||||
|^ (zing (turn ves case))
|
||||
::
|
||||
++ case
|
||||
|= vector-mac
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> `@ux`(macx key ~ in)
|
||||
--
|
||||
::
|
||||
++ test-aes-maca
|
||||
%+ do-test-vectors-mac maca
|
||||
:~
|
||||
:+ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0x0
|
||||
0xbb1d.6929.e959.3728.7fa3.7d12.9b75.6746
|
||||
::
|
||||
:+ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a
|
||||
0x70a.16b4.6b4d.4144.f79b.dd9d.d04a.287c
|
||||
::
|
||||
:+ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411
|
||||
0xdfa6.6747.de9a.e630.30ca.3261.1497.c827
|
||||
::
|
||||
:+ 0x2b7e.1516.28ae.d2a6.abf7.1588.09cf.4f3c
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0x51f0.bebf.7e3b.9d92.fc49.7417.7936.3cfe
|
||||
==
|
||||
++ test-aes-macb
|
||||
%+ do-test-vectors-mac macb
|
||||
:~
|
||||
:+ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0x0
|
||||
0xd17d.df46.adaa.cde5.31ca.c483.de7a.9367
|
||||
::
|
||||
:+ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a
|
||||
0x9e99.a7bf.31e7.1090.0662.f65e.617c.5184
|
||||
::
|
||||
:+ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411
|
||||
0x8a1d.e5be.2eb3.1aad.089a.82e6.ee90.8b0e
|
||||
::
|
||||
:+ 0x8e73.b0f7.da0e.6452.c810.f32b.8090.79e5.
|
||||
62f8.ead2.522c.6b7b
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0xa1d5.df0e.ed79.0f79.4d77.5896.59f3.9a11
|
||||
==
|
||||
++ test-aes-macc
|
||||
%+ do-test-vectors-mac macc
|
||||
:~
|
||||
:+ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0x0
|
||||
0x289.62f6.1b7b.f89e.fc6b.551f.4667.d983
|
||||
::
|
||||
:+ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a
|
||||
0x28a7.023f.452e.8f82.bd4b.f28d.8c37.c35c
|
||||
::
|
||||
:+ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411
|
||||
0xaaf3.d8f1.de56.40c2.32f5.b169.b9c9.11e6
|
||||
::
|
||||
:+ 0x603d.eb10.15ca.71be.2b73.aef0.857d.7781.
|
||||
1f35.2c07.3b61.08d7.2d98.10a3.0914.dff4
|
||||
0x6bc1.bee2.2e40.9f96.e93d.7e11.7393.172a.
|
||||
ae2d.8a57.1e03.ac9c.9eb7.6fac.45af.8e51.
|
||||
30c8.1c46.a35c.e411.e5fb.c119.1a0a.52ef.
|
||||
f69f.2445.df4f.9b17.ad2b.417b.e66c.3710
|
||||
0xe199.2190.549f.6ed5.696a.2c05.6c31.5410
|
||||
==
|
||||
::
|
||||
:: SIV mode. Test vectors from Project Wycheproof:
|
||||
:: https://github.com/google/wycheproof/blob/master/testvectors/aes_siv_cmac_test.json
|
||||
::
|
||||
:: Additional test vector from Appendix A of RFC 5297:
|
||||
:: https://tools.ietf.org/html/rfc5297#appendix-A
|
||||
::
|
||||
+$ vector-siv [key=@ux ad=(list @ux) in=@ux out=(trel @ux @ud @ux)]
|
||||
::
|
||||
++ do-test-vectors-siv
|
||||
|* [sivx=_siva ves=(list vector-siv)]
|
||||
^- tang
|
||||
|^ %+ weld
|
||||
%+ category "encrypting"
|
||||
(zing (turn ves enc))
|
||||
%+ category "decrypting"
|
||||
(zing (turn ves dec))
|
||||
::
|
||||
++ enc
|
||||
|= vector-siv
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> (~(en sivx key ad) in)
|
||||
::
|
||||
++ dec
|
||||
|= vector-siv
|
||||
%+ expect-eq
|
||||
!> `in
|
||||
!> (~(de sivx key ad) p.out q.out r.out)
|
||||
--
|
||||
::
|
||||
++ test-aes-siva
|
||||
%+ do-test-vectors-siv siva
|
||||
^- (list vector-siv)
|
||||
:~
|
||||
::
|
||||
:: from RFC 5297
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0x8563.2d07.c6e8.f37f.950a.cd32.0a2e.cc93
|
||||
14
|
||||
0x40c0.2b96.90c4.dc04.daef.7f6a.fe5c
|
||||
::
|
||||
:: same as above, sans AD
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
~
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0xf1c5.fdea.c1f1.5a26.779c.1501.f9fb.7588
|
||||
14
|
||||
0x27e9.46c6.6908.8ab0.6da5.8c5c.831c
|
||||
::
|
||||
:: same as above, sans message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x0
|
||||
:+
|
||||
0xb9d5.cc97.054d.cd3f.6dfd.a629.d4f4.d313
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: same as above, sans AD and message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff
|
||||
~
|
||||
0x0
|
||||
:+
|
||||
0xf200.7a5b.eb2b.8900.c588.a7ad.f599.f172
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: all subsequent vectors from Wycheproof
|
||||
::
|
||||
:^ 0x612e.8378.43ce.ae7f.61d4.9625.faa7.e749.
|
||||
4f92.53e2.0cb3.adce.a686.512b.0439.36cd
|
||||
:~ 0x865d.39ae.9b5e.9ff8.d630.8e00.2087.45bc
|
||||
==
|
||||
0xcc37.fae1.5f74.5a2f.40e2.c8b1.92f2.b38d
|
||||
:+
|
||||
0xc79c.86cd.7509.e60a.16ca.8cec.6bca.a1c5
|
||||
16
|
||||
0x8fbd.6099.7189.91fe.775b.f5a6.59d3.0a24
|
||||
::
|
||||
:^ 0x71a7.adc7.222f.471c.28f6.82c1.2d45.feed.
|
||||
4555.6000.a986.0359.2292.4ad1.54ba.5fa5
|
||||
:~ 0x46a6.5672.d269.9267.ab27.da82
|
||||
==
|
||||
0x227e.714e.3efa.84e4.8049.142e.daa3.11da.
|
||||
b285.407f.9b62.8b14.6f1d.6132.c250.0ca2.
|
||||
8497.fbd6.e386.679c
|
||||
:+
|
||||
0xb30e.c3b9.c854.02c3.5672.8391.acf0.4fcc
|
||||
40
|
||||
0xd02.ba85.b6a9.e90c.f846.155d.4ab3.1589.
|
||||
52bd.1791.8853.70bf.23ba.26d8.d233.5963.
|
||||
7b6e.24e8.763e.d107
|
||||
==
|
||||
::
|
||||
++ test-aes-sivb
|
||||
%+ do-test-vectors-siv sivb
|
||||
^- (list vector-siv)
|
||||
:~
|
||||
::
|
||||
:: from RFC 5297, with extended key
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0x89e8.69b9.3256.7851.54f0.9639.62fe.0740
|
||||
14
|
||||
0xf313.e667.b564.78a0.32b9.913e.923c
|
||||
::
|
||||
:: same as above, sans AD
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
~
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0xefc5.3765.c5a5.b1e0.69df.8927.3c57.4dc3
|
||||
14
|
||||
0x1a67.edd1.8a33.6b1f.5eb2.5a95.4844
|
||||
::
|
||||
:: same as above, sans message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x0
|
||||
:+
|
||||
0xad71.1b68.568c.e7dd.3669.8e4d.f947.8942
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: same as above, sans AD and message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
~
|
||||
0x0
|
||||
:+
|
||||
0x21ce.0f18.1d86.120b.0bf0.7cb6.1c5a.ac0d
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: all subsequent vectors from Wycheproof
|
||||
::
|
||||
:^ 0xca9d.b622.14c3.afab.385b.9086.f1cb.90d1.
|
||||
7195.d495.ef47.642d.bad0.6f4e.7d0b.ab13.
|
||||
6c77.8850.29ad.442b.30c3.4c8b.5290.e7d0
|
||||
:~ 0xd4db.fdce.11f1.147e.29dd.062e.a3bb.bd17
|
||||
==
|
||||
0xded5.a13d.7599.03ec.d36c.b238.5277.76c6
|
||||
:+
|
||||
0xa4e0.8bdd.8ab8.cbef.46e0.fdb8.a7ca.1097
|
||||
16
|
||||
0xa8f9.63e4.5e55.4a58.8249.6270.f9fd.6de8
|
||||
::
|
||||
:^ 0x5f6b.fe19.987d.5bf6.471d.d9e4.3609.4f7f.
|
||||
e33f.8acc.a3b8.a41e.2778.61e2.02bd.7262.
|
||||
fc2b.0bd3.df9b.35fa.2fc3.c579.620f.00eb
|
||||
:~ 0xb96c.8682.cd3c.e676.b0d7.9865
|
||||
==
|
||||
0x1485.126d.0476.bb4b.86d0.87d1.8926.32b5.3cb4.f8a2
|
||||
:+
|
||||
0x8fd1.214e.8078.2d7c.1400.7d03.7feb.1ab1
|
||||
20
|
||||
0x81fd.cb20.9858.87b5.ee8d.4acf.5589.924b.
|
||||
e644.947d
|
||||
::
|
||||
:^ 0x25b0.b404.bb1f.7844.6d0e.5cde.012e.e583.
|
||||
2cb4.0339.8a3e.66e9.b5a2.44b5.9d89.94ee.
|
||||
1018.4a57.76f3.578f.aab8.30e8.65f8.133c
|
||||
:~ 0x7fe4.97ba.cf30.af3a.8566.2aa1
|
||||
==
|
||||
0xb1b1.97cd.7ff6.8b62.e274.f5d1.046f.42f9.
|
||||
8171.63f0.a105.a0fb.7736.fa9e.5e8f.7694.
|
||||
4a22.282a.f480.ee79
|
||||
:+
|
||||
0xb440.39f1.e5ba.808c.a055.aea6.bc2d.819d
|
||||
40
|
||||
0x388e.3c27.1cd9.7c04.6061.e572.23bb.c2a1.
|
||||
7aa9.b368.d5cf.281d.e46f.48b3.4d17.9c16.
|
||||
cc9e.9d46.00a8.7af4
|
||||
==
|
||||
::
|
||||
++ test-aes-sivc
|
||||
%+ do-test-vectors-siv sivc
|
||||
^- (list vector-siv)
|
||||
:~
|
||||
::
|
||||
:: from RFC 5297, with extended key
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0x724d.fb2e.af94.dbb1.9b0b.a3a2.99a0.801e
|
||||
14
|
||||
0x1206.291a.35ad.3db0.2127.7344.0fd0
|
||||
::
|
||||
:: same as above, sans AD
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
~
|
||||
0x1122.3344.5566.7788.99aa.bbcc.ddee
|
||||
:+
|
||||
0x1dc0.45af.2d4d.9793.b874.09c2.501a.9412
|
||||
14
|
||||
0x7942.c766.bc8b.0e92.c859.9a38.d4d9
|
||||
::
|
||||
:: same as above, sans message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
:~ 0x1011.1213.1415.1617.1819.1a1b.1c1d.1e1f.
|
||||
2021.2223.2425.2627
|
||||
==
|
||||
0x0
|
||||
:+
|
||||
0xe99d.58c2.c500.7b5f.99a0.99b5.f68f.a556
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: same as above, sans AD and message
|
||||
::
|
||||
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.
|
||||
f0f1.f2f3.f4f5.f6f7.f8f9.fafb.fcfd.feff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff.
|
||||
0011.2233.4455.6677.8899.aabb.ccdd.eeff
|
||||
~
|
||||
0x0
|
||||
:+
|
||||
0x99c6.6f27.246f.a973.0dcf.370b.e03c.a7a3
|
||||
0
|
||||
0x0
|
||||
::
|
||||
:: all subsequent vectors from Wycheproof
|
||||
::
|
||||
:^ 0x27fa.f97f.b303.aa4f.2f36.4edd.2399.7f4c.
|
||||
77b8.e51e.bb82.93c5.9dfb.1d24.f0fb.629f.
|
||||
6c82.0fc2.d91b.f48f.0035.eeec.347e.37ec.
|
||||
4fb0.cb36.102b.cdc5.a248.c47a.2f97.eab9
|
||||
:~ 0xcc94.f64e.14df.9026.5f7f.12a8.a038.6d0a
|
||||
==
|
||||
0x6b1d.b0f5.a433.7688.5002.dc98.bd55.6f1d.
|
||||
ac9b.66b6.6213.a9fa.6069.df99.5a12.3384
|
||||
:+
|
||||
0xd001.6d67.5b49.f11e.a873.7074.12d4.5709
|
||||
32
|
||||
0xb770.3a02.8a0c.fc31.2cf6.1cbe.22b9.1e3c.
|
||||
f20b.7d4c.9308.ee15.f18b.4eba.0088.9284
|
||||
::
|
||||
:^ 0x3ab0.62db.dd38.b951.a9fb.0d8b.b185.959a.
|
||||
93da.b349.6b85.0a30.62b9.3003.036c.8bd2.
|
||||
aabb.f37d.5d3f.6a39.9d4c.edef.b70c.1b8a.
|
||||
7b45.639f.e118.c10e.39f3.6fa5.8618.a84d
|
||||
:~ 0xe860.5f13.db8c.482d.48bd.ba2d
|
||||
==
|
||||
0x5c6f
|
||||
:+
|
||||
0xfdde.a9ac.778b.978a.9680.33ce.52ec.6116
|
||||
2
|
||||
0x2588
|
||||
::
|
||||
:^ 0xcd86.89f8.2181.7f59.bfaa.7551.31f2.5651.
|
||||
61c7.f448.9f89.b657.ac9f.a127.a976.8535.
|
||||
a702.d001.b9b9.9cc1.1c39.7646.7b1b.4586.
|
||||
5ff4.17dc.256e.bb50.79b7.f1b3.e083.07b5
|
||||
:~ 0xb3ed.ffbb.89b3.73fe.04da.244b
|
||||
==
|
||||
0xebcf.b2ff.b681.cc5d.fa0c.5c52.4c1b.1cc8.
|
||||
7cc6.b2bf.a35d.c36d.15e8.0505.118b.84a0.
|
||||
72a7.8a15.7b4d.1837
|
||||
:+
|
||||
0x1ac7.8aae.2ede.04eb.4792.4d8f.9f99.fe75
|
||||
40
|
||||
0xdeb6.1bf6.93da.7f3a.2147.c05f.6d29.d173.
|
||||
9235.6fe0.0f82.b24c.dbce.774f.d864.5615.
|
||||
48f3.3dd3.192d.806f
|
||||
==
|
||||
--
|
156
pkg/arvo/tests/sys/zuse/crypto/ed25519.hoon
Normal file
156
pkg/arvo/tests/sys/zuse/crypto/ed25519.hoon
Normal file
@ -0,0 +1,156 @@
|
||||
:: tests for the ed25519 signature algorithm
|
||||
::
|
||||
/+ *test
|
||||
=, ed:crypto
|
||||
::
|
||||
|%
|
||||
::
|
||||
:: Test vectors from Section 7.1 of RFC 8032:
|
||||
:: https://tools.ietf.org/html/rfc8032#section-7.1
|
||||
::
|
||||
+$ vector [seed=@ux pk=@ux msg=@ux sig=@ux]
|
||||
::
|
||||
++ test-vectors
|
||||
^- tang
|
||||
|^ ;: weld
|
||||
%+ category "puck"
|
||||
(zing (turn vectors check-puck))
|
||||
%+ category "sign"
|
||||
(zing (turn vectors check-sign))
|
||||
%+ category "veri"
|
||||
(zing (turn vectors check-veri))
|
||||
==
|
||||
::
|
||||
++ check-puck
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> pk
|
||||
!> `@ux`(puck seed)
|
||||
::
|
||||
++ check-sign
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> sig
|
||||
!> `@ux`(sign msg seed)
|
||||
::
|
||||
++ check-veri
|
||||
|= vector
|
||||
%- expect
|
||||
!> (veri sig msg pk)
|
||||
::
|
||||
++ vectors
|
||||
^~ (turn vectors-raw swp-vec)
|
||||
++ swp-vec
|
||||
|= vector
|
||||
:^ (swp 3 seed)
|
||||
(swp 3 pk)
|
||||
(swp 3 msg)
|
||||
(swp 3 sig)
|
||||
++ vectors-raw
|
||||
:~
|
||||
:^ 0x9d61.b19d.effd.5a60.ba84.4af4.92ec.2cc4.
|
||||
4449.c569.7b32.6919.703b.ac03.1cae.7f60
|
||||
0xd75a.9801.82b1.0ab7.d54b.fed3.c964.073a.
|
||||
0ee1.72f3.daa6.2325.af02.1a68.f707.511a
|
||||
0x0
|
||||
0xe556.4300.c360.ac72.9086.e2cc.806e.828a.
|
||||
8487.7f1e.b8e5.d974.d873.e065.2249.0155.
|
||||
5fb8.8215.90a3.3bac.c61e.3970.1cf9.b46b.
|
||||
d25b.f5f0.595b.be24.6551.4143.8e7a.100b
|
||||
::
|
||||
:^ 0x4ccd.089b.28ff.96da.9db6.c346.ec11.4e0f.
|
||||
5b8a.319f.35ab.a624.da8c.f6ed.4fb8.a6fb
|
||||
0x3d40.17c3.e843.895a.92b7.0aa7.4d1b.7ebc.
|
||||
9c98.2ccf.2ec4.968c.c0cd.55f1.2af4.660c
|
||||
0x72
|
||||
0x92a0.09a9.f0d4.cab8.720e.820b.5f64.2540.
|
||||
a2b2.7b54.1650.3f8f.b376.2223.ebdb.69da.
|
||||
085a.c1e4.3e15.996e.458f.3613.d0f1.1d8c.
|
||||
387b.2eae.b430.2aee.b00d.2916.12bb.0c00
|
||||
::
|
||||
:^ 0xc5aa.8df4.3f9f.837b.edb7.442f.31dc.b7b1.
|
||||
66d3.8535.076f.094b.85ce.3a2e.0b44.58f7
|
||||
0xfc51.cd8e.6218.a1a3.8da4.7ed0.0230.f058.
|
||||
0816.ed13.ba33.03ac.5deb.9115.4890.8025
|
||||
0xaf82
|
||||
0x6291.d657.deec.2402.4827.e69c.3abe.01a3.
|
||||
0ce5.48a2.8474.3a44.5e36.80d7.db5a.c3ac.
|
||||
18ff.9b53.8d16.f290.ae67.f760.984d.c659.
|
||||
4a7c.15e9.716e.d28d.c027.bece.ea1e.c40a
|
||||
::
|
||||
:^ 0xf5e5.767c.f153.3195.1763.0f22.6876.b86c.
|
||||
8160.cc58.3bc0.1374.4c6b.f255.f5cc.0ee5
|
||||
0x2781.17fc.144c.7234.0f67.d0f2.316e.8386.
|
||||
ceff.bf2b.2428.c9c5.1fef.7c59.7f1d.426e
|
||||
0x8.b8b2.b733.4242.4376.0fe4.26a4.b549.
|
||||
0863.2110.a66c.2f65.91ea.bd33.45e3.e4eb.
|
||||
98fa.6e26.4bf0.9efe.12ee.50f8.f54e.9f77.
|
||||
b1e3.55f6.c505.44e2.3fb1.433d.df73.be84.
|
||||
d879.de7c.0046.dc49.96d9.e773.f4bc.9efe.
|
||||
5738.829a.db26.c81b.37c9.3a1b.270b.2032.
|
||||
9d65.8675.fc6e.a534.e081.0a44.3282.6bf5.
|
||||
8c94.1efb.65d5.7a33.8bbd.2e26.640f.89ff.
|
||||
bc1a.858e.fcb8.550e.e3a5.e199.8bd1.77e9.
|
||||
3a73.63c3.44fe.6b19.9ee5.d02e.82d5.22c4.
|
||||
feba.1545.2f80.288a.821a.5791.16ec.6dad.
|
||||
2b3b.310d.a903.401a.a621.00ab.5d1a.3655.
|
||||
3e06.203b.3389.0cc9.b832.f79e.f805.60cc.
|
||||
b9a3.9ce7.6796.7ed6.28c6.ad57.3cb1.16db.
|
||||
efef.d754.99da.96bd.68a8.a97b.928a.8bbc.
|
||||
103b.6621.fcde.2bec.a123.1d20.6be6.cd9e.
|
||||
c7af.f6f6.c94f.cd72.04ed.3455.c68c.83f4.
|
||||
a41d.a4af.2b74.ef5c.53f1.d8ac.70bd.cb7e.
|
||||
d185.ce81.bd84.359d.4425.4d95.629e.9855.
|
||||
a94a.7c19.58d1.f8ad.a5d0.532e.d8a5.aa3f.
|
||||
b2d1.7ba7.0eb6.248e.594e.1a22.97ac.bbb3.
|
||||
9d50.2f1a.8c6e.b6f1.ce22.b3de.1a1f.40cc.
|
||||
2455.4119.a831.a9aa.d607.9cad.8842.5de6.
|
||||
bde1.a918.7ebb.6092.cf67.bf2b.13fd.65f2.
|
||||
7088.d78b.7e88.3c87.59d2.c4f5.c65a.db75.
|
||||
5387.8ad5.75f9.fad8.78e8.0a0c.9ba6.3bcb.
|
||||
cc27.32e6.9485.bbc9.c90b.fbd6.2481.d908.
|
||||
9bec.cf80.cfe2.df16.a2cf.65bd.92dd.597b.
|
||||
0707.e091.7af4.8bbb.75fe.d413.d238.f555.
|
||||
5a7a.569d.80c3.414a.8d08.59dc.65a4.6128.
|
||||
bab2.7af8.7a71.314f.318c.782b.23eb.fe80.
|
||||
8b82.b0ce.2640.1d2e.22f0.4d83.d125.5dc5.
|
||||
1add.d3b7.5a2b.1ae0.7845.04df.543a.f896.
|
||||
9be3.ea70.82ff.7fc9.888c.144d.a2af.5842.
|
||||
9ec9.6031.dbca.d3da.d9af.0dcb.aaaf.268c.
|
||||
b8fc.ffea.d94f.3c7c.a495.e056.a9b4.7acd.
|
||||
b751.fb73.e666.c6c6.55ad.e829.7297.d07a.
|
||||
d1ba.5e43.f1bc.a323.0165.1339.e229.04cc.
|
||||
8c42.f58c.30c0.4aaf.db03.8dda.0847.dd98.
|
||||
8dcd.a6f3.bfd1.5c4b.4c45.2500.4aa0.6eef.
|
||||
f8ca.6178.3aac.ec57.fb3d.1f92.b0fe.2fd1.
|
||||
a85f.6724.517b.65e6.14ad.6808.d6f6.ee34.
|
||||
dff7.310f.dc82.aebf.d904.b01e.1dc5.4b29.
|
||||
2709.4b2d.b68d.6f90.3b68.401a.debf.5a7e.
|
||||
08d7.8ff4.ef5d.6365.3a65.040c.f9bf.d4ac.
|
||||
a798.4a74.d371.4598.6780.fc0b.16ac.4516.
|
||||
49de.6188.a7db.df19.1f64.b5fc.5e2a.b47b.
|
||||
57f7.f727.6cd4.19c1.7a3c.a8e1.b939.ae49.
|
||||
e488.acba.6b96.5610.b548.0109.c8b1.7b80.
|
||||
e1b7.b750.dfc7.598d.5d50.11fd.2dcc.5600.
|
||||
a32e.f5b5.2a1e.cc82.0e30.8aa3.4272.1aac.
|
||||
0943.bf66.86b6.4b25.7937.6504.ccc4.93d9.
|
||||
7e6a.ed3f.b0f9.cd71.a43d.d497.f01f.17c0.
|
||||
e2cb.3797.aa2a.2f25.6656.168e.6c49.6afc.
|
||||
5fb9.3246.f6b1.1163.98a3.46f1.a641.f3b0.
|
||||
41e9.89f7.914f.90cc.2c7f.ff35.7876.e506.
|
||||
b50d.334b.a77c.225b.c307.ba53.7152.f3f1.
|
||||
610e.4eaf.e595.f6d9.d90d.11fa.a933.a15e.
|
||||
f136.9546.868a.7f3a.45a9.6768.d40f.d9d0.
|
||||
3412.c091.c631.5cf4.fde7.cb68.6069.3738.
|
||||
0db2.eaaa.707b.4c41.85c3.2edd.cdd3.0670.
|
||||
5e4d.c1ff.c872.eeee.475a.64df.ac86.aba4.
|
||||
1c06.1898.3f87.41c5.ef68.d3a1.01e8.a3b8.
|
||||
cac6.0c90.5c15.fc91.0840.b94c.00a0.b9d0
|
||||
::
|
||||
0xaab.4c90.0501.b3e2.4d7c.df46.6332.6a3a.
|
||||
87df.5e48.43b2.cbdb.67cb.f6e4.60fe.c350.
|
||||
aa53.71b1.508f.9f45.28ec.ea23.c436.d94b.
|
||||
5e8f.cd4f.681e.30a6.ac00.a970.4a18.8a03
|
||||
==
|
||||
--
|
||||
--
|
265
pkg/arvo/tests/sys/zuse/crypto/hmac.hoon
Normal file
265
pkg/arvo/tests/sys/zuse/crypto/hmac.hoon
Normal file
@ -0,0 +1,265 @@
|
||||
:: tests for the hmac construction
|
||||
::
|
||||
/+ *test
|
||||
=, hmac:crypto
|
||||
::
|
||||
|%
|
||||
+$ vector [key=@ux in=@ux out=@ux]
|
||||
::
|
||||
++ do-test-vectors
|
||||
|* [hmac=_hmac-sha1 ves=(list vector)]
|
||||
^- tang
|
||||
|^ (zing (turn ves case))
|
||||
::
|
||||
++ case
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> out
|
||||
!> `@ux`(hmac key in)
|
||||
--
|
||||
::
|
||||
:: HMAC-SHA-1. Test vectors from section 3 of RFC 2202:
|
||||
:: https://tools.ietf.org/html/rfc2202#section-3
|
||||
::
|
||||
++ test-hmac-sha1
|
||||
%+ do-test-vectors hmac-sha1
|
||||
:~
|
||||
::
|
||||
:+ 0xb0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.
|
||||
0b0b.0b0b
|
||||
0x4869.2054.6865.7265
|
||||
0xb617.3186.5505.7264.e28b.c0b6.fb37.8c8e.
|
||||
f146.be00
|
||||
::
|
||||
:+ 0x4a65.6665
|
||||
0x7768.6174.2064.6f20.7961.2077.616e.7420.
|
||||
666f.7220.6e6f.7468.696e.673f
|
||||
0xeffc.df6a.e5eb.2fa2.d274.16d5.f184.df9c.
|
||||
259a.7c79
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0xdddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd
|
||||
0x125d.7342.b9ac.11cd.91a3.9af4.8aa1.7b4f.
|
||||
63f1.75d3
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f.
|
||||
1011.1213.1415.1617.1819
|
||||
0xcdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd
|
||||
0x4c90.07f4.0262.50c6.bc84.14f9.bf50.c86c.
|
||||
2d72.35da
|
||||
::
|
||||
:+ 0xc0c.0c0c.0c0c.0c0c.0c0c.0c0c.0c0c.0c0c.
|
||||
0c0c.0c0c
|
||||
0x5465.7374.2057.6974.6820.5472.756e.6361.
|
||||
7469.6f6e
|
||||
0x4c1a.0342.4b55.e07f.e7f2.7be1.d58b.b932.
|
||||
4a9a.5a04
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa
|
||||
0x5465.7374.2055.7369.6e67.204c.6172.6765.
|
||||
7220.5468.616e.2042.6c6f.636b.2d53.697a.
|
||||
6520.4b65.7920.2d20.4861.7368.204b.6579.
|
||||
2046.6972.7374
|
||||
0xaa4a.e5e1.5272.d00e.9570.5637.ce8a.3b55.
|
||||
ed40.2112
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa
|
||||
0x5465.7374.2055.7369.6e67.204c.6172.6765.
|
||||
7220.5468.616e.2042.6c6f.636b.2d53.697a.
|
||||
6520.4b65.7920.2d20.4861.7368.204b.6579.
|
||||
2046.6972.7374
|
||||
0xaa4a.e5e1.5272.d00e.9570.5637.ce8a.3b55.
|
||||
ed40.2112
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa
|
||||
0x54.6573.7420.5573.696e.6720.4c61.7267.
|
||||
6572.2054.6861.6e20.426c.6f63.6b2d.5369.
|
||||
7a65.204b.6579.2061.6e64.204c.6172.6765.
|
||||
7220.5468.616e.204f.6e65.2042.6c6f.636b.
|
||||
2d53.697a.6520.4461.7461
|
||||
0xe8e9.9d0f.4523.7d78.6d6b.baa7.965c.7808.
|
||||
bbff.1a91
|
||||
==
|
||||
::
|
||||
:: HMAC-SHA-256. Test vectors from section 4 of RFC 4231:
|
||||
:: https://tools.ietf.org/html/rfc4231#section-4
|
||||
::
|
||||
++ test-hmac-sha256
|
||||
%+ do-test-vectors hmac-sha256
|
||||
:~
|
||||
:+ 0xb0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.
|
||||
0b0b.0b0b
|
||||
0x4869.2054.6865.7265
|
||||
0xb034.4c61.d8db.3853.5ca8.afce.af0b.f12b.
|
||||
881d.c200.c983.3da7.26e9.376c.2e32.cff7
|
||||
::
|
||||
:+ 0x4a65.6665
|
||||
0x7768.6174.2064.6f20.7961.2077.616e.7420.
|
||||
666f.7220.6e6f.7468.696e.673f
|
||||
0x5bdc.c146.bf60.754e.6a04.2426.0895.75c7.
|
||||
5a00.3f08.9d27.3983.9dec.58b9.64ec.3843
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0xdddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd
|
||||
0x773e.a91e.3680.0e46.854d.b8eb.d091.81a7.
|
||||
2959.098b.3ef8.c122.d963.5514.ced5.65fe
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f.
|
||||
1011.1213.1415.1617.1819
|
||||
0xcdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd
|
||||
0x8255.8a38.9a44.3c0e.a4cc.8198.99f2.083a.
|
||||
85f0.faa3.e578.f807.7a2e.3ff4.6729.665b
|
||||
::
|
||||
:+ 0xaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0x5465.7374.2055.7369.6e67.204c.6172.6765.
|
||||
7220.5468.616e.2042.6c6f.636b.2d53.697a.
|
||||
6520.4b65.7920.2d20.4861.7368.204b.6579.
|
||||
2046.6972.7374
|
||||
0x60e4.3159.1ee0.b67f.0d8a.26aa.cbf5.b77f.
|
||||
8e0b.c621.3728.c514.0546.040f.0ee3.7f54
|
||||
::
|
||||
:+ 0xaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0x5468.6973.2069.7320.6120.7465.7374.2075.
|
||||
7369.6e67.2061.206c.6172.6765.7220.7468.
|
||||
616e.2062.6c6f.636b.2d73.697a.6520.6b65.
|
||||
7920.616e.6420.6120.6c61.7267.6572.2074.
|
||||
6861.6e20.626c.6f63.6b2d.7369.7a65.2064.
|
||||
6174.612e.2054.6865.206b.6579.206e.6565.
|
||||
6473.2074.6f20.6265.2068.6173.6865.6420.
|
||||
6265.666f.7265.2062.6569.6e67.2075.7365.
|
||||
6420.6279.2074.6865.2048.4d41.4320.616c.
|
||||
676f.7269.7468.6d2e
|
||||
0x9b09.ffa7.1b94.2fcb.2763.5fbc.d5b0.e944.
|
||||
bfdc.6364.4f07.1393.8a7f.5153.5c3a.35e2
|
||||
==
|
||||
::
|
||||
:: HMAC-SHA-512. Test vectors from section 4 of RFC 4231:
|
||||
:: https://tools.ietf.org/html/rfc4231#section-4
|
||||
::
|
||||
++ test-hmac-sha512
|
||||
%+ do-test-vectors hmac-sha512
|
||||
:~
|
||||
::
|
||||
:+ 0xb0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.0b0b.
|
||||
0b0b.0b0b
|
||||
0x4869.2054.6865.7265
|
||||
0x87aa.7cde.a5ef.619d.4ff0.b424.1a1d.6cb0.
|
||||
2379.f4e2.ce4e.c278.7ad0.b305.45e1.7cde.
|
||||
daa8.33b7.d6b8.a702.038b.274e.aea3.f4e4.
|
||||
be9d.914e.eb61.f170.2e69.6c20.3a12.6854
|
||||
::
|
||||
:+ 0x4a65.6665
|
||||
0x7768.6174.2064.6f20.7961.2077.616e.7420.
|
||||
666f.7220.6e6f.7468.696e.673f
|
||||
0x164b.7a7b.fcf8.19e2.e395.fbe7.3b56.e0a3.
|
||||
87bd.6422.2e83.1fd6.1027.0cd7.ea25.0554.
|
||||
9758.bf75.c05a.994a.6d03.4f65.f8f0.e6fd.
|
||||
caea.b1a3.4d4a.6b4b.636e.070a.38bc.e737
|
||||
::
|
||||
:+ 0xaaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0xdddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd.dddd.dddd.dddd.dddd.dddd.dddd.dddd.
|
||||
dddd
|
||||
0xfa73.b008.9d56.a284.efb0.f075.6c89.0be9.
|
||||
b1b5.dbdd.8ee8.1a36.55f8.3e33.b227.9d39.
|
||||
bf3e.8482.79a7.22c8.06b4.85a4.7e67.c807.
|
||||
b946.a337.bee8.9426.7427.8859.e132.92fb
|
||||
::
|
||||
:+ 0x1.0203.0405.0607.0809.0a0b.0c0d.0e0f.
|
||||
1011.1213.1415.1617.1819
|
||||
0xcdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.cdcd.
|
||||
cdcd
|
||||
0xb0ba.4656.3745.8c69.90e5.a8c5.f61d.4af7.
|
||||
e576.d97f.f94b.872d.e76f.8050.361e.e3db.
|
||||
a91c.a5c1.1aa2.5eb4.d679.275c.c578.8063.
|
||||
a5f1.9741.120c.4f2d.e2ad.ebeb.10a2.98dd
|
||||
::
|
||||
:+ 0xaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0x5465.7374.2055.7369.6e67.204c.6172.6765.
|
||||
7220.5468.616e.2042.6c6f.636b.2d53.697a.
|
||||
6520.4b65.7920.2d20.4861.7368.204b.6579.
|
||||
2046.6972.7374
|
||||
0x80b2.4263.c7c1.a3eb.b714.93c1.dd7b.e8b4.
|
||||
9b46.d1f4.1b4a.eec1.121b.0137.83f8.f352.
|
||||
6b56.d037.e05f.2598.bd0f.d221.5d6a.1e52.
|
||||
95e6.4f73.f63f.0aec.8b91.5a98.5d78.6598
|
||||
::
|
||||
:+ 0xaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.aaaa.
|
||||
aaaa.aaaa
|
||||
0x5468.6973.2069.7320.6120.7465.7374.2075.
|
||||
7369.6e67.2061.206c.6172.6765.7220.7468.
|
||||
616e.2062.6c6f.636b.2d73.697a.6520.6b65.
|
||||
7920.616e.6420.6120.6c61.7267.6572.2074.
|
||||
6861.6e20.626c.6f63.6b2d.7369.7a65.2064.
|
||||
6174.612e.2054.6865.206b.6579.206e.6565.
|
||||
6473.2074.6f20.6265.2068.6173.6865.6420.
|
||||
6265.666f.7265.2062.6569.6e67.2075.7365.
|
||||
6420.6279.2074.6865.2048.4d41.4320.616c.
|
||||
676f.7269.7468.6d2e
|
||||
0xe37b.6a77.5dc8.7dba.a4df.a9f9.6e5e.3ffd.
|
||||
debd.71f8.8672.8986.5df5.a32d.20cd.c944.
|
||||
b602.2cac.3c49.82b1.0d5e.eb55.c3e4.de15.
|
||||
1346.76fb.6de0.4460.65c9.7440.fa8c.6a58
|
||||
==
|
||||
--
|
70
pkg/arvo/tests/sys/zuse/crypto/scrypt.hoon
Normal file
70
pkg/arvo/tests/sys/zuse/crypto/scrypt.hoon
Normal file
@ -0,0 +1,70 @@
|
||||
:: tests for the scrypt key derivation algorithm
|
||||
::
|
||||
/+ *test
|
||||
=, scr:crypto
|
||||
::
|
||||
|%
|
||||
::
|
||||
:: Test vectors from Section 12 of RFC 7914:
|
||||
:: https://tools.ietf.org/html/rfc7914.html#section-12
|
||||
::
|
||||
+$ vector [pw=@ux salt=@ux n=@ud r=@ud p=@ud out=@ux]
|
||||
::
|
||||
++ test-vectors
|
||||
^- tang
|
||||
|^ (zing (turn vectors case))
|
||||
::
|
||||
++ case
|
||||
|= vector
|
||||
%+ expect-eq
|
||||
!> (swp 3 out)
|
||||
!> `@ux`(hsh pw salt n r p 64)
|
||||
::
|
||||
++ vectors
|
||||
:: TODO: until scrypt has been jetted, we can only test the
|
||||
:: first vector; the others do not finish in a reasonable
|
||||
:: amount of time.
|
||||
%+ scag 1 ^- (list vector)
|
||||
:~
|
||||
:*
|
||||
0x0
|
||||
0x0
|
||||
16 1 1
|
||||
0x77d6.5762.3865.7b20.3b19.ca42.c18a.0497.
|
||||
f16b.4844.e307.4ae8.dfdf.fa3f.ede2.1442.
|
||||
fcd0.069d.ed09.48f8.326a.753a.0fc8.1f17.
|
||||
e8d3.e0fb.2e0d.3628.cf35.e20c.38d1.8906
|
||||
==
|
||||
::
|
||||
:*
|
||||
0x7061.7373.776f.7264
|
||||
0x4e61.436c
|
||||
1.024 8 16
|
||||
0xfdba.be1c.9d34.7200.7856.e719.0d01.e9fe.
|
||||
7c6a.d7cb.c823.7830.e773.7663.4b37.3162.
|
||||
2eaf.30d9.2e22.a388.6ff1.0927.9d98.30da.
|
||||
c727.afb9.4a83.ee6d.8360.cbdf.a2cc.0640
|
||||
==
|
||||
::
|
||||
:*
|
||||
0x70.6c65.6173.656c.6574.6d65.696e
|
||||
0x536f.6469.756d.4368.6c6f.7269.6465
|
||||
16.384 8 1
|
||||
0x7023.bdcb.3afd.7348.461c.06cd.81fd.38eb.
|
||||
fda8.fbba.904f.8e3e.a9b5.43f6.545d.a1f2.
|
||||
d543.2955.613f.0fcf.62d4.9705.242a.9af9.
|
||||
e61e.85dc.0d65.1e40.dfcf.017b.4557.5887
|
||||
==
|
||||
::
|
||||
:*
|
||||
0x70.6c65.6173.656c.6574.6d65.696e
|
||||
0x536f.6469.756d.4368.6c6f.7269.6465
|
||||
1.048.576 8 1
|
||||
0x2101.cb9b.6a51.1aae.addb.be09.cf70.f881.
|
||||
ec56.8d57.4a2f.fd4d.abe5.ee98.20ad.aa47.
|
||||
8e56.fd8f.4ba5.d09f.fa1c.6d92.7c40.f4c3.
|
||||
3730.4049.e8a9.52fb.cbf4.5c6f.a77a.41a4
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
Loading…
Reference in New Issue
Block a user