Keccak
Pure-Crystal Keccak-256 (the Ethereum hash, NOT SHA3-256: domain byte is 0x01 instead of 0x06). Used for offline merkle-tree generation; the Crystal stdlib has no binding that exposes keccak-256.
Implements the Keccak-f[1600] permutation with rate 1088 bits (136 bytes) and a 256-bit output.
Constants
RATE = 136
RC = [1_u64, 32898_u64, 9223372036854808714_u64, 9223372039002292224_u64, 32907_u64, 2147483649_u64, 9223372039002292353_u64, 9223372036854808585_u64, 138_u64, 136_u64, 2147516425_u64, 2147483658_u64, 2147516555_u64, 9223372036854775947_u64, 9223372036854808713_u64, 9223372036854808579_u64, 9223372036854808578_u64, 9223372036854775936_u64, 32778_u64, 9223372039002259466_u64, 9223372039002292353_u64, 9223372036854808704_u64, 2147483649_u64, 9223372039002292232_u64]
24 round constants (keccak-f[1600]).
ROT = [0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14]
rho rotation amounts, indexed as state[i] where i = x + 5y.