crypto_shorthash.c 629 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "crypto_shorthash.h"
  2. #include "randombytes.h"
  3. size_t
  4. crypto_shorthash_bytes(void)
  5. {
  6. return crypto_shorthash_BYTES;
  7. }
  8. size_t
  9. crypto_shorthash_keybytes(void)
  10. {
  11. return crypto_shorthash_KEYBYTES;
  12. }
  13. const char *
  14. crypto_shorthash_primitive(void)
  15. {
  16. return crypto_shorthash_PRIMITIVE;
  17. }
  18. int
  19. crypto_shorthash(unsigned char *out, const unsigned char *in,
  20. unsigned long long inlen, const unsigned char *k)
  21. {
  22. return crypto_shorthash_siphash24(out, in, inlen, k);
  23. }
  24. void
  25. crypto_shorthash_keygen(unsigned char k[crypto_shorthash_KEYBYTES])
  26. {
  27. randombytes_buf(k, crypto_shorthash_KEYBYTES);
  28. }