#![no_std] use digest::dev::{fixed_reset_test, xof_reset_test}; use digest::{hash_serialization_test, new_test}; use hex_literal::hex; // new_test values are from https://github.com/kazcw/yellowsun/blob/test-keccak/src/lib.rs#L171 new_test!(keccak_224, "keccak_224", sha3::Keccak224, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( keccak_224_serialization, sha3::Keccak224, hex!(" 44fd24cba7fce860dc98a80dc7fb7d47 bf139f3230ded727d6f9ef31809bbf97 31d84d0b9c2329188e172173b6bdf162 110beca9038378bff2438eb8564d8d72 e7a82b9bb891918e71ed71bc7b0669d3 5cf60adf4a9239ad8da020500b1061b1 cb60c04da0d36e4c1174776188f10b17 dbff4ba813efe418a669a64b6637d400 d245105d585b3e9968db9031e3552d2a f11c65f70c1ccfebc2b56fcc6cc01fb5 172ba2421f7421e615276188334e72fe 314abd05cf754d381e6e37056fa59208 0051cc0117f141730113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 000000000000000000 ") ); new_test!(keccak_256, "keccak_256", sha3::Keccak256, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( keccak_256_serialization, sha3::Keccak256, hex!(" fc47e7fccd77882a725bb285776a86bb 894158aff4b1b7b1dac04e5fbf46eb54 71d660b46236f53e01fa72ad115bfecc 5f612b2f2ff5f01bf7dd6b6ad0d3b3c4 f938a789505134417873fb5c459f7948 fa79ee740848afb6195c58b160ae1d44 4023d4e0308935a8bd27f7254189a3bf b2c192bcb9a46607e919ef89dfeb7cc2 2a4e9b68a597eaf59e337dd807e1abfd 7e447e24024806d9108ac859e70592c5 f1262b322d2f66eb79be7011fc093a8e 77944fd80e7874194cf4139e6dd2db21 457ece6d445a2a740113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(keccak_384, "keccak_384", sha3::Keccak384, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( keccak_384_serialization, sha3::Keccak384, hex!(" 4c0e2029fe5337ba52489efa9b16fd56 444067cb57201b34d41b895f7cd8ed55 f158738fb7bed087678916c410578be3 b72d861fc340c2b38226bc7d87198295 d0b99e50fac033d5ca13f18d67887530 7301c500850fa7c7a3cfab39e1207cfa b0a75522a0c062283ecd6f505d10a057 75129005b9badbcf37f64b37d8a97a1e d6d4637908eaf29862f464c079e4238a 0f97a0cd0653a2ee5ae43299319e3c13 7a96672c6b0fc76eab1982ed7df52181 5629f1440977df882d4fff69e5882524 0204c9dfaeff9bc50113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(keccak_512, "keccak_512", sha3::Keccak512, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( keccak_512_serialization, sha3::Keccak512, hex!(" e79e949fb144d267375cca9fa29f47f4 5faca4ac7d7b70fa3b892587ca64d28f 1f3b4baf1d7f4192cc29d1656bca631c 05492ddaaf3b767c63ce45f36d03eead f4e86127f0221230b964ceb0a97387df eab91a107657ea46087148ae1bc8bee2 9e5a6dc3869a616b68dcadf67ea2745c 31ffc101f31192ae40dd44ca1025b2ca 96f9c0a3891b1f870115ef6c15af3bcc 81958eac548089b535342c542108a510 366d728b0daf6030a1ae7f1428d8a322 0d3501a6e36eb272b7d59b69bfe7f71f 4978bbae6553ed8d0113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!( keccak_256_full, "keccak_256_full", sha3::Keccak256Full, fixed_reset_test ); #[rustfmt::skip] hash_serialization_test!( keccak_256_full_serialization, sha3::Keccak256Full, hex!(" fc47e7fccd77882a725bb285776a86bb 894158aff4b1b7b1dac04e5fbf46eb54 71d660b46236f53e01fa72ad115bfecc 5f612b2f2ff5f01bf7dd6b6ad0d3b3c4 f938a789505134417873fb5c459f7948 fa79ee740848afb6195c58b160ae1d44 4023d4e0308935a8bd27f7254189a3bf b2c192bcb9a46607e919ef89dfeb7cc2 2a4e9b68a597eaf59e337dd807e1abfd 7e447e24024806d9108ac859e70592c5 f1262b322d2f66eb79be7011fc093a8e 77944fd80e7874194cf4139e6dd2db21 457ece6d445a2a740113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(sha3_224, "sha3_224", sha3::Sha3_224, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( sha3_224_serialization, sha3::Sha3_224, hex!(" 44fd24cba7fce860dc98a80dc7fb7d47 bf139f3230ded727d6f9ef31809bbf97 31d84d0b9c2329188e172173b6bdf162 110beca9038378bff2438eb8564d8d72 e7a82b9bb891918e71ed71bc7b0669d3 5cf60adf4a9239ad8da020500b1061b1 cb60c04da0d36e4c1174776188f10b17 dbff4ba813efe418a669a64b6637d400 d245105d585b3e9968db9031e3552d2a f11c65f70c1ccfebc2b56fcc6cc01fb5 172ba2421f7421e615276188334e72fe 314abd05cf754d381e6e37056fa59208 0051cc0117f141730113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 000000000000000000 ") ); new_test!(sha3_256, "sha3_256", sha3::Sha3_256, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( sha3_256_serialization, sha3::Sha3_256, hex!(" fc47e7fccd77882a725bb285776a86bb 894158aff4b1b7b1dac04e5fbf46eb54 71d660b46236f53e01fa72ad115bfecc 5f612b2f2ff5f01bf7dd6b6ad0d3b3c4 f938a789505134417873fb5c459f7948 fa79ee740848afb6195c58b160ae1d44 4023d4e0308935a8bd27f7254189a3bf b2c192bcb9a46607e919ef89dfeb7cc2 2a4e9b68a597eaf59e337dd807e1abfd 7e447e24024806d9108ac859e70592c5 f1262b322d2f66eb79be7011fc093a8e 77944fd80e7874194cf4139e6dd2db21 457ece6d445a2a740113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(sha3_384, "sha3_384", sha3::Sha3_384, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( sha3_384_serialization, sha3::Sha3_384, hex!(" 4c0e2029fe5337ba52489efa9b16fd56 444067cb57201b34d41b895f7cd8ed55 f158738fb7bed087678916c410578be3 b72d861fc340c2b38226bc7d87198295 d0b99e50fac033d5ca13f18d67887530 7301c500850fa7c7a3cfab39e1207cfa b0a75522a0c062283ecd6f505d10a057 75129005b9badbcf37f64b37d8a97a1e d6d4637908eaf29862f464c079e4238a 0f97a0cd0653a2ee5ae43299319e3c13 7a96672c6b0fc76eab1982ed7df52181 5629f1440977df882d4fff69e5882524 0204c9dfaeff9bc50113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(sha3_512, "sha3_512", sha3::Sha3_512, fixed_reset_test); #[rustfmt::skip] hash_serialization_test!( sha3_512_serialization, sha3::Sha3_512, hex!(" e79e949fb144d267375cca9fa29f47f4 5faca4ac7d7b70fa3b892587ca64d28f 1f3b4baf1d7f4192cc29d1656bca631c 05492ddaaf3b767c63ce45f36d03eead f4e86127f0221230b964ceb0a97387df eab91a107657ea46087148ae1bc8bee2 9e5a6dc3869a616b68dcadf67ea2745c 31ffc101f31192ae40dd44ca1025b2ca 96f9c0a3891b1f870115ef6c15af3bcc 81958eac548089b535342c542108a510 366d728b0daf6030a1ae7f1428d8a322 0d3501a6e36eb272b7d59b69bfe7f71f 4978bbae6553ed8d0113000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00 ") ); new_test!(shake128, "shake128", sha3::Shake128, xof_reset_test); new_test!(shake256, "shake256", sha3::Shake256, xof_reset_test);