File: siphash.h

package info (click to toggle)
ruby1.9.1 1.9.3.194-8.1%2Bdeb7u5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 67,684 kB
  • sloc: ruby: 528,270; ansic: 518,972; xml: 25,427; yacc: 17,944; sh: 3,208; lisp: 1,998; tcl: 949; pascal: 723; makefile: 635; perl: 62; python: 47; awk: 36; asm: 35; sed: 27
file content (48 lines) | stat: -rw-r--r-- 1,284 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef SIPHASH_H
#define SIPHASH_H 1
#include <stdlib.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif

#ifndef HAVE_UINT64_T
typedef struct {
    uint32_t u32[2];
} sip_uint64_t;
#define uint64_t sip_uint64_t
#else
typedef uint64_t sip_uint64_t;
#endif

typedef struct {
    int c;
    int d;
    uint64_t v[4];
    uint8_t buf[sizeof(uint64_t)];
    uint8_t buflen;
    uint8_t msglen_byte;
} sip_state;

typedef struct sip_interface_st sip_interface;

typedef struct {
    sip_state state[1];
    const sip_interface *methods;
} sip_hash;

sip_hash *sip_hash_new(const uint8_t key[16], int c, int d);
sip_hash *sip_hash_init(sip_hash *h, const uint8_t key[16], int c, int d);
int sip_hash_update(sip_hash *h, const uint8_t *data, size_t len);
int sip_hash_final(sip_hash *h, uint8_t **digest, size_t *len);
int sip_hash_final_integer(sip_hash *h, uint64_t *digest);
int sip_hash_digest(sip_hash *h, const uint8_t *data, size_t data_len, uint8_t **digest, size_t *digest_len);
int sip_hash_digest_integer(sip_hash *h, const uint8_t *data, size_t data_len, uint64_t *digest);
void sip_hash_free(sip_hash *h);
void sip_hash_dump(sip_hash *h);

uint64_t sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len);

#endif