|
| 1 | +#ifndef CTHASH_SHA3_SHA3_HPP |
| 2 | +#define CTHASH_SHA3_SHA3_HPP |
| 3 | + |
| 4 | +#include "common.hpp" |
| 5 | + |
| 6 | +namespace cthash { |
| 7 | + |
| 8 | +using sha3_224_config = sha_config<224u>; |
| 9 | +static_assert((sha3_224_config::capacity_bit + sha3_224_config::rate_bit) == 1600u); |
| 10 | + |
| 11 | +using sha3_256_config = sha_config<256u>; |
| 12 | +static_assert((sha3_256_config::capacity_bit + sha3_256_config::rate_bit) == 1600u); |
| 13 | + |
| 14 | +using sha3_384_config = sha_config<384u>; |
| 15 | +static_assert((sha3_384_config::capacity_bit + sha3_384_config::rate_bit) == 1600u); |
| 16 | + |
| 17 | +using sha3_512_config = sha_config<512u>; |
| 18 | +static_assert((sha3_512_config::capacity_bit + sha3_512_config::rate_bit) == 1600u); |
| 19 | + |
| 20 | +// hasher and value type |
| 21 | +using sha3_224 = cthash::keccak_hasher<sha3_224_config>; |
| 22 | +using sha3_224_value = tagged_hash_value<sha3_224_config>; |
| 23 | +using sha3_256 = cthash::keccak_hasher<sha3_256_config>; |
| 24 | +using sha3_256_value = tagged_hash_value<sha3_256_config>; |
| 25 | +using sha3_384 = cthash::keccak_hasher<sha3_384_config>; |
| 26 | +using sha3_384_value = tagged_hash_value<sha3_384_config>; |
| 27 | +using sha3_512 = cthash::keccak_hasher<sha3_512_config>; |
| 28 | +using sha3_512_value = tagged_hash_value<sha3_512_config>; |
| 29 | + |
| 30 | +namespace literals { |
| 31 | + |
| 32 | + template <fixed_string Value> |
| 33 | + consteval auto operator""_sha3_224() { |
| 34 | + return sha3_224_value(Value); |
| 35 | + } |
| 36 | + |
| 37 | + template <fixed_string Value> |
| 38 | + consteval auto operator""_sha3_256() { |
| 39 | + return sha3_256_value(Value); |
| 40 | + } |
| 41 | + |
| 42 | + template <fixed_string Value> |
| 43 | + consteval auto operator""_sha3_384() { |
| 44 | + return sha3_384_value(Value); |
| 45 | + } |
| 46 | + |
| 47 | + template <fixed_string Value> |
| 48 | + consteval auto operator""_sha3_512() { |
| 49 | + return sha3_512_value(Value); |
| 50 | + } |
| 51 | + |
| 52 | +} // namespace literals |
| 53 | + |
| 54 | +} // namespace cthash |
| 55 | + |
| 56 | +#endif |
0 commit comments