ft_ssl.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_ssl.h :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2018/09/20 23:18:13 by bchanot #+# #+# */
  9. /* Updated: 2018/10/14 04:07:26 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #ifndef FT_SSL_H
  13. # define FT_SSL_H
  14. # define ROL64(a, b) (((a) << (b)) | ((a) >> (64 - (b))))
  15. # define ROR64(a, b) (((a) >> (b)) | ((a) << (64 - (b))))
  16. # define ROL32(a, b) (((a) << (b)) | ((a) >> (32 - (b))))
  17. # define ROR32(a, b) (((a) >> (b)) | ((a) << (32 - (b))))
  18. # define CH(x, y, z) (((x) & (y)) ^ (~(x) & (z)))
  19. # define MAJ(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
  20. # define HASH_FUNCTIONS sl_md5, sl_sha224, sl_sha256, sl_sha384, sl_sha512
  21. # define HASH_TAB "md5", "sha224", "sha256", "sha384", "sha512"
  22. # define NB_HASH 5
  23. # include "libft.h"
  24. typedef struct s_files
  25. {
  26. char *name;
  27. char *string;
  28. t_bool s_opt;
  29. struct s_files *next;
  30. } t_files;
  31. typedef struct s_inf
  32. {
  33. char **opts;
  34. char *hash_tag;
  35. void (*func)(const char *str);
  36. t_files *files;
  37. } t_inf;
  38. int sl_get_inf(t_inf *inf, int ac, char **av);
  39. void sl_choose_hash(t_inf *inf);
  40. void sl_prepare_launch(t_inf *inf);
  41. void sl_md5(const char *str);
  42. void sl_sha224(const char *str);
  43. void sl_sha256(const char *str);
  44. void sl_sha384(const char *str);
  45. void sl_sha512(const char *str);
  46. #endif