| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* sl_sha3_5.h :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2018/09/26 20:13:19 by bchanot #+# #+# */
- /* Updated: 2018/10/10 12:57:18 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #ifndef SL_SHA3_5_H
- # define SL_SHA3_5_H
- # define EP0_SHA3_5(x) (ROR64(x, 28) ^ ROR64(x, 34) ^ ROR64(x, 39))
- # define EP1_SHA3_5(x) (ROR64(x, 14) ^ ROR64(x, 18) ^ ROR64(x, 41))
- # define SIG0_SHA3_5(x) (ROR64(x, 1) ^ ROR64(x, 8) ^ ((x) >> 7))
- # define SIG1_SHA3_5(x) (ROR64(x, 19) ^ ROR64(x, 61) ^ ((x) >> 6))
- # define SHA384 0
- # define SHA512 1
- typedef struct s_sha3_5
- {
- t_uint8 buff[128];
- t_uint64 state[8];
- t_uint64 count[4];
- } t_sha3_5;
- typedef struct s_process_sha3_5
- {
- t_uint64 a;
- t_uint64 b;
- t_uint64 c;
- t_uint64 d;
- t_uint64 e;
- t_uint64 f;
- t_uint64 g;
- t_uint64 h;
- } t_process_sha3_5;
- void sl_sha3_5_get_registers(t_uint64 *m, t_process_sha3_5 *t, \
- size_t i);
- void sl_sha3_5_process_init_add(t_sha3_5 *ctx, t_process_sha3_5 *t, \
- t_bool init);
- void sl_sha3_5_init(t_sha3_5 *ctx, t_uint8 sha);
- void sl_sha3_5_update(t_sha3_5 *ctx, const t_uint8 *data, \
- size_t len);
- void sl_sha3_5_final(t_sha3_5 *ctx);
- void sl_sha3_5_get_hash(t_sha3_5 *ctx, t_uint8 *hash);
- #endif
|