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