]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_subr/fnv1a.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_subr / fnv1a.h
1 /*
2  * fnv1a.h :  routines to create checksums derived from FNV-1a
3  *
4  * ====================================================================
5  *    Licensed to the Apache Software Foundation (ASF) under one
6  *    or more contributor license agreements.  See the NOTICE file
7  *    distributed with this work for additional information
8  *    regarding copyright ownership.  The ASF licenses this file
9  *    to you under the Apache License, Version 2.0 (the
10  *    "License"); you may not use this file except in compliance
11  *    with the License.  You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  *    Unless required by applicable law or agreed to in writing,
16  *    software distributed under the License is distributed on an
17  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  *    KIND, either express or implied.  See the License for the
19  *    specific language governing permissions and limitations
20  *    under the License.
21  * ====================================================================
22  */
23
24 #ifndef SVN_LIBSVN_SUBR_FNV1A_H
25 #define SVN_LIBSVN_SUBR_FNV1A_H
26
27 #include <apr_pools.h>
28
29 #include "svn_types.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35 /* Opaque FNV-1a checksum creation context type.
36  */
37 typedef struct svn_fnv1a_32__context_t svn_fnv1a_32__context_t;
38
39 /* Return a new FNV-1a checksum creation context allocated in POOL.
40  */
41 svn_fnv1a_32__context_t *
42 svn_fnv1a_32__context_create(apr_pool_t *pool);
43
44 /* Feed LEN bytes from DATA into the FNV-1a checksum creation CONTEXT.
45  */
46 void
47 svn_fnv1a_32__update(svn_fnv1a_32__context_t *context,
48                      const void *data,
49                      apr_size_t len);
50
51 /* Return the FNV-1a checksum over all data fed into  CONTEXT.
52  */
53 apr_uint32_t
54 svn_fnv1a_32__finalize(svn_fnv1a_32__context_t *context);
55
56
57 /* Opaque modified FNV-1a checksum creation context type.
58  */
59 typedef struct svn_fnv1a_32x4__context_t svn_fnv1a_32x4__context_t;
60
61 /* Return a new modified FNV-1a checksum creation context allocated in POOL.
62  */
63 svn_fnv1a_32x4__context_t *
64 svn_fnv1a_32x4__context_create(apr_pool_t *pool);
65
66 /* Feed LEN bytes from DATA into the modified FNV-1a checksum creation
67  * CONTEXT.
68  */
69 void
70 svn_fnv1a_32x4__update(svn_fnv1a_32x4__context_t *context,
71                        const void *data,
72                        apr_size_t len);
73
74 /* Return the modified FNV-1a checksum over all data fed into  CONTEXT.
75  */
76 apr_uint32_t
77 svn_fnv1a_32x4__finalize(svn_fnv1a_32x4__context_t *context);
78
79 /* Set HASHES to the 4 partial hash sums produced by the modified FVN-1a
80  * over INPUT of LEN bytes.
81  */
82 void
83 svn__fnv1a_32x4_raw(apr_uint32_t hashes[4],
84                     const void *input,
85                     apr_size_t len);
86
87 #ifdef __cplusplus
88 }
89 #endif /* __cplusplus */
90
91 #endif /* SVN_LIBSVN_SUBR_FNV1A_H */