Apache Portable Runtime Utility Library
apr_siphash.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /*
17  SipHash reference C implementation
18  Copyright (c) 2012-2014 Jean-Philippe Aumasson
19  <jeanphilippe.aumasson@gmail.com>
20  Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
21  To the extent possible under law, the author(s) have dedicated all copyright
22  and related and neighboring rights to this software to the public domain
23  worldwide. This software is distributed without any warranty.
24  You should have received a copy of the CC0 Public Domain Dedication along
25  with this software. If not, see
26  <http://creativecommons.org/publicdomain/zero/1.0/>.
27  */
28 
29 #ifndef APR_SIPHASH_H
30 #define APR_SIPHASH_H
31 
32 #include "apr.h"
33 #include "apu.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
54 #define APR_SIPHASH_DSIZE 8
55 
57 #define APR_SIPHASH_KSIZE 16
58 
59 
70 APU_DECLARE(apr_uint64_t) apr_siphash(const void *src, apr_size_t len,
71  const unsigned char key[APR_SIPHASH_KSIZE],
72  unsigned int c, unsigned int d);
73 
87 APU_DECLARE(void) apr_siphash_auth(unsigned char out[APR_SIPHASH_DSIZE],
88  const void *src, apr_size_t len,
89  const unsigned char key[APR_SIPHASH_KSIZE],
90  unsigned int c, unsigned int d);
91 
100 APU_DECLARE(apr_uint64_t) apr_siphash24(const void *src, apr_size_t len,
101  const unsigned char key[APR_SIPHASH_KSIZE]);
102 
114 APU_DECLARE(void) apr_siphash24_auth(unsigned char out[APR_SIPHASH_DSIZE],
115  const void *src, apr_size_t len,
116  const unsigned char key[APR_SIPHASH_KSIZE]);
117 
126 APU_DECLARE(apr_uint64_t) apr_siphash48(const void *src, apr_size_t len,
127  const unsigned char key[APR_SIPHASH_KSIZE]);
128 
140 APU_DECLARE(void) apr_siphash48_auth(unsigned char out[APR_SIPHASH_DSIZE],
141  const void *src, apr_size_t len,
142  const unsigned char key[APR_SIPHASH_KSIZE]);
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* APR_SIPHASH_H */
apr_siphash48
apr_uint64_t apr_siphash48(const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE])
Computes SipHash-4-8, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
APR_SIPHASH_KSIZE
#define APR_SIPHASH_KSIZE
Definition: apr_siphash.h:57
apr_siphash_auth
void apr_siphash_auth(unsigned char out[APR_SIPHASH_DSIZE], const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE], unsigned int c, unsigned int d)
Computes SipHash-c-d, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
apr_siphash24
apr_uint64_t apr_siphash24(const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE])
Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
APR_SIPHASH_DSIZE
#define APR_SIPHASH_DSIZE
Definition: apr_siphash.h:54
apr_siphash24_auth
void apr_siphash24_auth(unsigned char out[APR_SIPHASH_DSIZE], const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE])
Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
apr_siphash
apr_uint64_t apr_siphash(const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE], unsigned int c, unsigned int d)
Computes SipHash-c-d, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...
apr_siphash48_auth
void apr_siphash48_auth(unsigned char out[APR_SIPHASH_DSIZE], const void *src, apr_size_t len, const unsigned char key[APR_SIPHASH_KSIZE])
Computes SipHash-4-8, producing a 64bit (APR_SIPHASH_DSIZE) hash from a message and a 128bit (APR_SIP...