Started from buttom go to the sky

This commit is contained in:
Raphaël 2024-04-28 19:59:01 +02:00
parent 96215449bd
commit f811e55dea
4781 changed files with 10121 additions and 1743 deletions

View file

@ -0,0 +1,52 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hasher.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maix <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/10 19:50:39 by maix #+# #+# */
/* Updated: 2023/12/27 16:44:09 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef HASHER_H
# define HASHER_H
# include "me/types.h"
typedef void (*t_hash_bytes)(void *hasher, t_u8 *bytes,
t_usize count);
typedef t_u64 (*t_hasher_finish)(void *hasher);
typedef t_u64 (*t_hasher_reset_and_finish)(void *hasher);
typedef struct s_hasher
{
void *hasher;
t_hash_bytes hash_bytes;
t_hasher_finish finish;
t_hasher_reset_and_finish reset_and_finish;
} t_hasher;
void hasher_write_bytes(t_hasher *hasher,
t_u8 *bytes, t_usize count);
void hasher_write_u8(t_hasher *hasher, t_u8 n);
void hasher_write_u16(t_hasher *hasher, t_u16 n);
void hasher_write_u32(t_hasher *hasher, t_u32 n);
void hasher_write_u64(t_hasher *hasher, t_u64 n);
void hasher_write_usize(t_hasher *hasher, t_usize n);
void hasher_write_i8(t_hasher *hasher, t_i8 n);
void hasher_write_i16(t_hasher *hasher, t_i16 n);
void hasher_write_i32(t_hasher *hasher, t_i32 n);
void hasher_write_i64(t_hasher *hasher, t_i64 n);
void hasher_write_isize(t_hasher *hasher, t_isize n);
void hasher_write_str(t_hasher *hasher, t_str str);
t_u64 hasher_finish(t_hasher *hasher);
t_u64 hasher_reset_and_finish(t_hasher *hasher);
#endif

View file

@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sip.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maix <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/10 19:33:46 by maix #+# #+# */
/* Updated: 2023/12/11 15:10:07 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SIP_H
# define SIP_H
# include "me/hash/hasher.h"
# include "me/types.h"
typedef struct s_sip_state
{
t_u64 v0;
t_u64 v2;
t_u64 v1;
t_u64 v3;
} t_sip_state;
typedef struct s_sip13
{
t_u64 k0;
t_u64 k1;
t_usize length;
t_u64 tail;
t_usize ntail;
t_sip_state state;
} t_sip13;
t_hasher hasher_sip13_new(void);
#endif

View file

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sip_utils.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maix <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/10 19:34:10 by maix #+# #+# */
/* Updated: 2023/12/27 16:48:51 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SIP_UTILS_H
# define SIP_UTILS_H
# include "me/hash/sip.h"
# include "me/types.h"
void compress(t_sip_state *state);
t_sip_state create_state_with_key(t_u64 k0, t_u64 k1);
t_u64 sip13_finish(t_sip13 *hasher);
t_u64 sip13_reset_and_finish(t_sip13 *hasher);
void sip13_write_bytes(t_sip13 *self, t_u8 *msg, t_usize count);
#endif