crypto_generichash.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef crypto_generichash_H
  2. #define crypto_generichash_H
  3. #include <stddef.h>
  4. #include "crypto_generichash_blake2b.h"
  5. #include "export.h"
  6. #ifdef __cplusplus
  7. # ifdef __GNUC__
  8. # pragma GCC diagnostic ignored "-Wlong-long"
  9. # endif
  10. extern "C" {
  11. #endif
  12. #define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN
  13. SODIUM_EXPORT
  14. size_t crypto_generichash_bytes_min(void);
  15. #define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX
  16. SODIUM_EXPORT
  17. size_t crypto_generichash_bytes_max(void);
  18. #define crypto_generichash_BYTES crypto_generichash_blake2b_BYTES
  19. SODIUM_EXPORT
  20. size_t crypto_generichash_bytes(void);
  21. #define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN
  22. SODIUM_EXPORT
  23. size_t crypto_generichash_keybytes_min(void);
  24. #define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX
  25. SODIUM_EXPORT
  26. size_t crypto_generichash_keybytes_max(void);
  27. #define crypto_generichash_KEYBYTES crypto_generichash_blake2b_KEYBYTES
  28. SODIUM_EXPORT
  29. size_t crypto_generichash_keybytes(void);
  30. #define crypto_generichash_PRIMITIVE "blake2b"
  31. SODIUM_EXPORT
  32. const char *crypto_generichash_primitive(void);
  33. /*
  34. * Important when writing bindings for other programming languages:
  35. * the state address should be 64-bytes aligned.
  36. */
  37. typedef crypto_generichash_blake2b_state crypto_generichash_state;
  38. SODIUM_EXPORT
  39. size_t crypto_generichash_statebytes(void);
  40. SODIUM_EXPORT
  41. int crypto_generichash(unsigned char *out, size_t outlen,
  42. const unsigned char *in, unsigned long long inlen,
  43. const unsigned char *key, size_t keylen)
  44. __attribute__ ((nonnull(1)));
  45. SODIUM_EXPORT
  46. int crypto_generichash_init(crypto_generichash_state *state,
  47. const unsigned char *key,
  48. const size_t keylen, const size_t outlen)
  49. __attribute__ ((nonnull(1)));
  50. SODIUM_EXPORT
  51. int crypto_generichash_update(crypto_generichash_state *state,
  52. const unsigned char *in,
  53. unsigned long long inlen)
  54. __attribute__ ((nonnull(1)));
  55. SODIUM_EXPORT
  56. int crypto_generichash_final(crypto_generichash_state *state,
  57. unsigned char *out, const size_t outlen)
  58. __attribute__ ((nonnull));
  59. SODIUM_EXPORT
  60. void crypto_generichash_keygen(unsigned char k[crypto_generichash_KEYBYTES])
  61. __attribute__ ((nonnull));
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif