shrub/tests/sys/zuse/crypto/scrypt.hoon
fang e888960370
tests: move to root, out of pkg/arvo
Including these in pkg/arvo has caused many minor problems over the
years. We don't want to include them in releases, but this often meant
excluding them manually, which was error-prone.

Here, we move them out of /pkg/arvo/tests and into /tests. CI will have
to be updated to match, since we'll still want to include tests there.
2023-01-18 16:50:42 +01:00

68 lines
1.6 KiB
Plaintext

:: 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
^- (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
==
::
:*
`@ux`'password'
`@ux`'NaCl'
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
==
::
:*
`@ux`'pleaseletmein'
`@ux`'SodiumChloride'
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
==
::
:*
`@ux`'pleaseletmein'
`@ux`'SodiumChloride'
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
==
==
--
--