def main

bend-osdev-crypto@0.1.0.0 · check.bend:400

import bend-osdev-crypto@0.1.0.0/check.bend as Check
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
import bend-osdev-cipher-modes@0.1.0.0/aes.bend as X
import bend-osdev-legacy-ciphers@0.1.0.0/des.bend as D
import bend-osdev-legacy-ciphers@0.1.0.0/tdes.bend as T
import bend-osdev-legacy-ciphers@0.1.0.0/sm4.bend as S
import bend-osdev-legacy-ciphers@0.1.0.0/camellia.bend as Ca
import bend-osdev-legacy-ciphers@0.1.0.0/serpent.bend as Sp
import bend-osdev-legacy-ciphers@0.1.0.0/twofish.bend as Tf
import bend-osdev-crc@0.1.0.0/crc.bend as C
import bend-osdev-crypto@0.1.0.0/block.bend as Bk
import bend-osdev-crypto@0.1.0.0/hash.bend as H
import bend-osdev-crypto@0.1.0.0/inst_cm.bend as CM
import bend-osdev-crypto@0.1.0.0/inst_lc.bend as LC
import bend-osdev-crypto@0.1.0.0/inst_aes.bend as A
import bend-osdev-crypto@0.1.0.0/inst_crc.bend as CR
import bend-osdev-crypto@0.1.0.0/inst_sha2.bend as SH
import bend-osdev-crypto@0.1.0.0/inst_sha3.bend as S3
import bend-osdev-legacy-ciphers@0.1.0.0/aria.bend as Ar
import bend-osdev-legacy-ciphers@0.1.0.0/cast6.bend as C6
import bend-osdev-legacy-ciphers@0.1.0.0/blowfish.bend as Bf
import bend-osdev-legacy-ciphers@0.1.0.0/cast5.bend as C5
import bend-osdev-legacy-ciphers@0.1.0.0/tea.bend as Te
import bend-osdev-legacy-ciphers@0.1.0.0/xtea.bend as Xt
import bend-osdev-legacy-ciphers@0.1.0.0/fcrypt.bend as Fc
import bend-osdev-hashes@0.1.0.0/hashes.bend as Hs
import bend-osdev-hashes@0.1.0.0/md4.bend as HM4
import bend-osdev-hashes@0.1.0.0/md5.bend as HM5
import bend-osdev-hashes@0.1.0.0/sha1.bend as HS1
import bend-osdev-hashes@0.1.0.0/ripemd160.bend as HRM
import bend-osdev-hashes@0.1.0.0/sm3.bend as HSM
import bend-osdev-hashes@0.1.0.0/streebog.bend as HST

400def main() -> IO(Unit):
401  +k16 = hx("0123456789abcdeffedcba9876543210")
402  +z16 = B.Octets.zeros(16n)
403  +nk = hx("2b7e151628aed2a6abf7158809cf4f3c")
404  +f4 = hx("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710")
405  +ck = hx("c0c1c2c3c4c5c6c7c8c9cacbcccdcecf")
406  do IO<Unit>:
407    IO.print(aes(hx("000102030405060708090a0b0c0d0e0f"), hx("00112233445566778899aabbccddeeff")))
408    IO.print(aes(hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"), hx("00112233445566778899aabbccddeeff")))
409    IO.print(lc64(~D.LcDesKey, ~LC.CrLc.key(~D.LcDesKey, ~D.LcDes.key), ~D.LcDes.encrypt, ~D.LcDes.decrypt, hx("0101010101010101"), hx("8000000000000000")))
410    IO.print(lc64(~T.LcTdesKey, ~LC.CrLc.key(~T.LcTdesKey, ~T.LcTdes.key), ~T.LcTdes.encrypt, ~T.LcTdes.decrypt, hx("0123456789abcdef23456789abcdef01456789abcdef0123"), B.Octets.of_string("The qufc")))
411    IO.print(lc128(~S.LcSm4Key, ~LC.CrLc.key(~S.LcSm4Key, ~S.LcSm4.key), ~S.LcSm4.encrypt, ~S.LcSm4.decrypt, k16, k16))
412    IO.print(lc128(~Ca.LcCamelliaKey, ~LC.CrLc.key(~Ca.LcCamelliaKey, ~Ca.LcCamellia.key), ~Ca.LcCamellia.encrypt, ~Ca.LcCamellia.decrypt, k16, k16))
413    IO.print(lc128(~Sp.LcSerpentKey, ~LC.CrLc.key(~Sp.LcSerpentKey, ~Sp.LcSerpent.key), ~Sp.LcSerpent.encrypt, ~Sp.LcSerpent.decrypt, z16, z16))
414    IO.print(lc128(~Tf.LcTwofishKey, ~LC.CrLc.key(~Tf.LcTwofishKey, ~Tf.LcTwofish.key), ~Tf.LcTwofish.encrypt, ~Tf.LcTwofish.decrypt, z16, z16))
415    IO.print(aes_ecb(nk, f4))
416    IO.print(aes_cbc(nk, hx("000102030405060708090a0b0c0d0e0f"), f4))
417    IO.print(show(aes_ctr(nk, hx("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"), f4)))
418    IO.print(tdes_cbc(hx("0123456789abcdef23456789abcdef01456789abcdef0123"), hx("f69f2445df4f9b17"), B.Octets.of_string("The qufck brown fox jump")))
419    IO.print(show(des_ctr_pieces(hx("0123456789abcdef"), hx("fffffffffffffffe"), B.Octets.zeros(5n), B.Octets.zeros(14n))))
420    IO.print(show(rc4(hx("0102030405"), 16n)))
421    IO.print(show(rc4_pieces(hx("0102030405"))))
422    IO.print(show(rc4_drop(hx("0102030405"))))
423    IO.print(cmac(nk, B.Octets.empty()))
424    IO.print(cmac(nk, B.Octets.take(16n, f4)))
425    IO.print(cmac(nk, B.Octets.take(40n, f4)))
426    IO.print(cmac(nk, f4))
427    IO.print(ccm(~8n, ck, hx("00000003020100a0a1a2a3a4a5"), hx("0001020304050607"), hx("08090a0b0c0d0e0f101112131415161718191a1b1c1d1e")))
428    IO.print(ccm(~8n, ck, hx("00000004030201a0a1a2a3a4a5"), hx("0001020304050607"), hx("08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")))
429    IO.print(ccm(~8n, ck, hx("00000005040302a0a1a2a3a4a5"), hx("0001020304050607"), hx("08090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20")))
430    IO.print(B.Octets.hex(CR.CrCrc32.digest(~C.crc32.spec(), B.Octets.of_string("123456789"))))
431    IO.print(B.Octets.hex(CR.CrCrc64.digest(~C.crc64_xz.spec(), B.Octets.of_string("123456789"))))
432    IO.print(crc32_pieces(B.Octets.of_string("1234"), B.Octets.empty(), B.Octets.of_string("56789")))
433    IO.print(hmac_crc32(B.Octets.of_string("key"), B.Octets.of_string("The quick"), B.Octets.of_string(" brown fox")))
434    IO.print(hmac_crc64(big(100n), B.Octets.of_string("a message")))
435    IO.print(hkdf_crc32(B.Octets.of_string("secret"), B.Octets.of_string("salt"), B.Octets.of_string("info"), 10n))
436    IO.print(hkdf_crc32_max(B.Octets.of_string("secret")))
437    IO.print(sm4_cbc_big(k16, z16, big(32768n)))
438    IO.print(aes_ctr_big(nk, hx("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"), big(32771n)))
439    IO.print(show(Bk.CrBlockCipher.encrypt_with(~X.CmAesKey, ~M.CmBlock, ~A.CrAes.key, ~X.CmAes.encrypt, ~CM.CrBlk128.of_octets, ~CM.CrBlk128.to_octets, B.Octets.zeros(24n), z16)))
440    IO.print(show(Bk.CrBlockCipher.encrypt_with(~X.CmAesKey, ~M.CmBlock, ~A.CrAes.key, ~X.CmAes.encrypt, ~CM.CrBlk128.of_octets, ~CM.CrBlk128.to_octets, z16, B.Octets.zeros(15n))))
441    IO.print(show(aes_ctr(nk, B.Octets.zeros(12n), f4)))
442    IO.print(aes_cbc(nk, z16, B.Octets.zeros(17n)))
443    IO.print(show(rc4(B.Octets.empty(), 4n)))
444    IO.print(hkdf_crc32(B.Octets.of_string("secret"), B.Octets.empty(), B.Octets.empty(), 1021n))
445
446    IO.print(sha(~SH.CrSha2.sha256, B.Octets.of_string("abc")))
447    IO.print(sha(~SH.CrSha2.sha256, B.Octets.of_string("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")))
448    IO.print(sha(~SH.CrSha2.sha512, B.Octets.of_string("abc")))
449    IO.print(sha_pieces3(~SH.CrSha2.init256(), B.Octets.of_string("abcdbcdecdefdefgefgh"), B.Octets.empty(), B.Octets.of_string("fghighijhijkijkljklmklmnlmnomnopnopq")))
450    IO.print(sha_pieces3(~SH.CrSha2.init512(), B.Octets.of_string("a"), B.Octets.of_string("b"), B.Octets.of_string("c")))
451    IO.print(sha(~S3.CrSha3.sha3_256, B.Octets.of_string("abc")))
452    IO.print(sha(~S3.CrSha3.sha3_256, B.Octets.empty()))
453    IO.print(sha(~S3.CrSha3.sha3_256, hx("a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3")))
454    IO.print(B.Octets.hex(H.CrHash.of_pieces(~S3.CrSha3State, ~S3.CrSha3.init(), ~S3.CrSha3.update, ~S3.CrSha3.final, [hx("a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3"), B.Octets.empty(), hx("a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3")])))
455    IO.print(B.Octets.hex(hmac_sha(~136n, ~S3.CrSha3.sha3_256, hx("4a656665"), hx("7768617420646f2079612077616e7420666f72206e6f7468696e673f"))))
456    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), hx("4869205468657265"))))
457    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), hx("4869205468657265"))))
458    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("4a656665"), hx("7768617420646f2079612077616e7420666f72206e6f7468696e673f"))))
459    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("4a656665"), hx("7768617420646f2079612077616e7420666f72206e6f7468696e673f"))))
460    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"))))
461    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"))))
462    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("0102030405060708090a0b0c0d0e0f10111213141516171819"), hx("cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"))))
463    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("0102030405060708090a0b0c0d0e0f10111213141516171819"), hx("cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"))))
464    IO.print(B.Octets.hex(B.Octets.take(16n, hmac_sha(~64n, ~SH.CrSha2.sha256, hx("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c"), hx("546573742057697468205472756e636174696f6e")))))
465    IO.print(B.Octets.hex(B.Octets.take(16n, hmac_sha(~128n, ~SH.CrSha2.sha512, hx("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c"), hx("546573742057697468205472756e636174696f6e")))))
466    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374"))))
467    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374"))))
468    IO.print(B.Octets.hex(hmac_sha(~64n, ~SH.CrSha2.sha256, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("5468697320697320612074657374207573696e672061206c6172676572207468616e20626c6f636b2d73697a65206b657920616e642061206c6172676572207468616e20626c6f636b2d73697a6520646174612e20546865206b6579206e6565647320746f20626520686173686564206265666f7265206265696e6720757365642062792074686520484d414320616c676f726974686d2e"))))
469    IO.print(B.Octets.hex(hmac_sha(~128n, ~SH.CrSha2.sha512, hx("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), hx("5468697320697320612074657374207573696e672061206c6172676572207468616e20626c6f636b2d73697a65206b657920616e642061206c6172676572207468616e20626c6f636b2d73697a6520646174612e20546865206b6579206e6565647320746f20626520686173686564206265666f7265206265696e6720757365642062792074686520484d414320616c676f726974686d2e"))))
470    IO.print(hmac_sha256_pieces(hx("4a656665"), B.Octets.of_string("what do ya"), B.Octets.of_string(" want for nothing?")))
471    IO.print(hkdf_sha256(hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), hx("000102030405060708090a0b0c"), hx("f0f1f2f3f4f5f6f7f8f9"), 42n))
472    IO.print(hkdf_sha256(hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f"), hx("606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"), hx("b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"), 82n))
473    IO.print(hkdf_sha256(hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), hx(""), hx(""), 42n))
474    IO.print(lc128(~Ar.LcAriaKey, ~LC.CrLc.key(~Ar.LcAriaKey, ~Ar.LcAria.key), ~Ar.LcAria.encrypt, ~Ar.LcAria.decrypt, hx("000102030405060708090a0b0c0d0e0f"), hx("00112233445566778899aabbccddeeff")))
475    IO.print(lc128(~C6.LcCast6Key, ~LC.CrLc.key(~C6.LcCast6Key, ~C6.LcCast6.key), ~C6.LcCast6.encrypt, ~C6.LcCast6.decrypt, hx("2342bb9efa38542c0af75647f29f615d"), z16))
476    IO.print(lc64(~Bf.LcBlowfishKey, ~LC.CrLc.key(~Bf.LcBlowfishKey, ~Bf.LcBlowfish.key), ~Bf.LcBlowfish.encrypt, ~Bf.LcBlowfish.decrypt, hx("fedcba9876543210"), hx("0123456789abcdef")))
477    IO.print(lc64(~C5.LcCast5Key, ~LC.CrLc.key(~C5.LcCast5Key, ~C5.LcCast5.key), ~C5.LcCast5.encrypt, ~C5.LcCast5.decrypt, hx("0123456712345678234567893456789a"), hx("0123456789abcdef")))
478    IO.print(lc64(~Te.LcTeaKey, ~LC.CrLc.key(~Te.LcTeaKey, ~Te.LcTea.key), ~Te.LcTea.encrypt, ~Te.LcTea.decrypt, hx("000102030405060708090a0b0c0d0e0f"), hx("0001020304050607")))
479    IO.print(lc64(~Xt.LcXteaKey, ~LC.CrLc.key(~Xt.LcXteaKey, ~Xt.LcXtea.key), ~Xt.LcXtea.encrypt, ~Xt.LcXtea.decrypt, hx("000102030405060708090a0b0c0d0e0f"), hx("0001020304050607")))
480    IO.print(lc64(~Fc.LcFcryptKey, ~LC.CrLc.key(~Fc.LcFcryptKey, ~Fc.LcFcrypt.key), ~Fc.LcFcrypt.encrypt, ~Fc.LcFcrypt.decrypt, hx("114477aadd003366"), hx("123456789abcdef0")))
481    IO.print(pcbc_fc(hx("3141592653589793"), hx("2718281828459045"), hx("74686973206973206120746573740000")))
482    IO.print(lrw_aes(hx("4562ac25f828176d4c268414b5680185258e2a05e73e9d03ee5a830ccc094c87"), hx("00000000000000000000000000000001"), hx("30313233343536373839414243444546")))
483    IO.print(lrw_aes(hx("59704714f557478cd779e80f548879440d48f0b7b15a53ea1caa6b29c2cafbaf"), hx("00000000000000000000000000000002"), hx("30313233343536373839414243444546")))
484    IO.print(lrw_aes(hx("d82a9134b26a565030fe69e2377f9847cdf90b160c648fb6b00d0d1bae85871f"), hx("00000000000000000000000200000000"), hx("30313233343536373839414243444546")))
485    IO.print(lrw_aes(hx("f8d476ffd646ee6c2384cb1c77d6195dfef1a9f37bbc8d21a79c21f8cb900289a845348ec8c5b5f126f50e76fefd1b1e"), hx("00000000000000000000000000000001"), hx("30313233343536373839414243444546")))
486    IO.print(lrw_aes(hx("fb7615b23d80891dd470980bc79584c8b2fb64ce6097878d17fce45a49e830b76e7817e72d5e12d46064047af12f9e0c"), hx("00000000000000000000000200000000"), hx("30313233343536373839414243444546")))
487    IO.print(cts_aes(hx("636869636b656e207465726979616b69"), z16, hx("4920776f756c64206c696b652074686520")))
488    IO.print(cts_aes(hx("636869636b656e207465726979616b69"), z16, hx("4920776f756c64206c696b65207468652047656e6572616c20476175277320")))
489    IO.print(cts_aes(hx("636869636b656e207465726979616b69"), z16, hx("4920776f756c64206c696b65207468652047656e6572616c2047617527732043")))
490    IO.print(cts_aes(hx("636869636b656e207465726979616b69"), z16, hx("4920776f756c64206c696b65207468652047656e6572616c20476175277320436869636b656e2c20706c656173652c20616e6420776f6e746f6e20736f75702e")))
491    IO.print(cts_aes(hx("636869636b656e207465726979616b69"), z16, hx("4920776f756c64206c696b6520")))
492    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), B.Octets.empty()))
493    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), hx("000102")))
494    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), hx("000102030405060708090a0b0c0d0e0f")))
495    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), hx("000102030405060708090a0b0c0d0e0f10111213")))
496    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")))
497    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021")))
498    IO.print(xcbc_aes(hx("000102030405060708090a0b0c0d0e0f"), B.Octets.zeros(1000n)))
499    IO.print(vmac_aes(~1n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.empty()))
500    IO.print(vmac_aes(~2n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.empty()))
501    IO.print(vmac_aes(~1n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string("abc")))
502    IO.print(vmac_aes(~2n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string("abc")))
503    IO.print(vmac_aes(~1n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string(rep(16n, "abc", ""))))
504    IO.print(vmac_aes(~2n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string(rep(16n, "abc", ""))))
505    IO.print(vmac_aes(~1n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string(rep(100n, "abc", ""))))
506    IO.print(vmac_aes(~2n, B.Octets.of_string("abcdefghijklmnop"), B.Octets.of_string("bcdefghi"), B.Octets.of_string(rep(100n, "abc", ""))))
507    IO.print(hs_hash(~Hs.HsMdState<Hs.HsW4>, ~HM4.HsMd4.init(), ~HM4.HsMd4.update, ~HM4.HsMd4.final, ~HM4.HsMd4.digest, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
508    IO.print(hs_hash(~Hs.HsMdState<Hs.HsW4>, ~HM5.HsMd5.init(), ~HM5.HsMd5.update, ~HM5.HsMd5.final, ~HM5.HsMd5.digest, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
509    IO.print(hs_hash(~Hs.HsMdState<Hs.HsW5>, ~HS1.HsSha1.init(), ~HS1.HsSha1.update, ~HS1.HsSha1.final, ~HS1.HsSha1.digest, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
510    IO.print(hs_hash(~Hs.HsMdState<Hs.HsW5>, ~HRM.HsRipemd160.init(), ~HRM.HsRipemd160.update, ~HRM.HsRipemd160.final, ~HRM.HsRipemd160.digest, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
511    IO.print(hs_hash(~Hs.HsMdState<Hs.HsW8>, ~HSM.HsSm3.init(), ~HSM.HsSm3.update, ~HSM.HsSm3.final, ~HSM.HsSm3.digest, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
512    IO.print(hs_hash(~Hs.HsMdState<HST.HsStbCv>, ~HST.HsStreebog.init256(), ~HST.HsStreebog.update, ~HST.HsStreebog.final256, ~HST.HsStreebog.digest256, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
513    IO.print(hs_hash(~Hs.HsMdState<HST.HsStbCv>, ~HST.HsStreebog.init512(), ~HST.HsStreebog.update, ~HST.HsStreebog.final512, ~HST.HsStreebog.digest512, B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound"), B.Octets.of_string("ary.")))
514    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW4>, ~64n, ~HM5.HsMd5.init(), ~HM5.HsMd5.update, ~HM5.HsMd5.final, ~HM5.HsMd5.digest, hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), B.Octets.of_string("Hi Th"), B.Octets.of_string("ere")))
515    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW4>, ~64n, ~HM5.HsMd5.init(), ~HM5.HsMd5.update, ~HM5.HsMd5.final, ~HM5.HsMd5.digest, B.Octets.of_string("Jefe"), B.Octets.of_string("what "), B.Octets.of_string("do ya want for nothing?")))
516    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW5>, ~64n, ~HS1.HsSha1.init(), ~HS1.HsSha1.update, ~HS1.HsSha1.final, ~HS1.HsSha1.digest, hx("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"), B.Octets.of_string("Hi Th"), B.Octets.of_string("ere")))
517    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW5>, ~64n, ~HS1.HsSha1.init(), ~HS1.HsSha1.update, ~HS1.HsSha1.final, ~HS1.HsSha1.digest, B.Octets.of_string("Jefe"), B.Octets.of_string("what "), B.Octets.of_string("do ya want for nothing?")))
518    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW4>, ~64n, ~HM4.HsMd4.init(), ~HM4.HsMd4.update, ~HM4.HsMd4.final, ~HM4.HsMd4.digest, hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445"), B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound")))
519    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW5>, ~64n, ~HRM.HsRipemd160.init(), ~HRM.HsRipemd160.update, ~HRM.HsRipemd160.final, ~HRM.HsRipemd160.digest, hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445"), B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound")))
520    IO.print(hs_hmac(~Hs.HsMdState<Hs.HsW8>, ~64n, ~HSM.HsSm3.init(), ~HSM.HsSm3.update, ~HSM.HsSm3.final, ~HSM.HsSm3.digest, hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445"), B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound")))
521    IO.print(hs_hmac(~Hs.HsMdState<HST.HsStbCv>, ~64n, ~HST.HsStreebog.init256(), ~HST.HsStreebog.update, ~HST.HsStreebog.final256, ~HST.HsStreebog.digest256, hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445"), B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound")))
522    IO.print(hs_hmac(~Hs.HsMdState<HST.HsStbCv>, ~64n, ~HST.HsStreebog.init512(), ~HST.HsStreebog.update, ~HST.HsStreebog.final512, ~HST.HsStreebog.digest512, hx("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445"), B.Octets.of_string("The quick brown fox "), B.Octets.of_string("jumps over the lazy dog, and then some more bytes to cross a block bound")))
523    IO.print(michael_mac(hx("0000000000000000"), B.Octets.empty()))
524    IO.print(michael_mac(hx("82925c1ca1d130b8"), B.Octets.of_string("M")))
525    IO.print(michael_mac(hx("434721ca40639b3f"), B.Octets.of_string("Mi")))
526    IO.print(michael_mac(hx("e8f9becae97e5d29"), B.Octets.of_string("Mic")))
527    IO.print(michael_mac(hx("90038fc6cf13c1db"), B.Octets.of_string("Mich")))
528    IO.print(michael_mac(hx("d55e100510128986"), B.Octets.of_string("Michael")))
529    IO.print(michael_mac(hx("00000000000000"), B.Octets.empty()))
530    IO.print(pbkdf2_sha1(B.Octets.of_string("password"), B.Octets.of_string("salt"), 1, 20n))
531    IO.print(pbkdf2_sha1(B.Octets.of_string("password"), B.Octets.of_string("salt"), 2, 20n))
532    IO.print(pbkdf2_sha1(B.Octets.of_string("password"), B.Octets.of_string("salt"), 4096, 20n))
533    IO.print(pbkdf2_sha1(B.Octets.of_string("passwordPASSWORDpassword"), B.Octets.of_string("saltSALTsaltSALTsaltSALTsaltSALTsalt"), 4096, 25n))
534    IO.print(pbkdf2_sha1(hx("7061737300776f7264"), hx("7361006c74"), 4096, 16n))
535    IO.print(pbkdf2_sha256(B.Octets.of_string("passwd"), B.Octets.of_string("salt"), 1, 64n))
536    IO.print(pbkdf2_sha256(B.Octets.of_string("Password"), B.Octets.of_string("NaCl"), 80000, 64n))
537    IO.print(pbkdf2_sha1(B.Octets.of_string("password"), B.Octets.of_string("salt"), 0, 20n))
538    IO.print(pbkdf2_md5_kdf(B.Octets.of_string("secret"), B.Octets.of_string("NaCl"), 40n))
539    IO.print(kbkdf_counter(42n))
540    IO.print(kbkdf_feedback(42n))
541    IO.print(kbkdf_short_counter(8161n))

Uses (159)

Used by (0)

No other definition uses this definition.