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 /* Reset the FNV-1a checksum CONTEXT to initial state. 45 */ 46 void 47 svn_fnv1a_32__context_reset(svn_fnv1a_32__context_t *context); 48 49 /* Feed LEN bytes from DATA into the FNV-1a checksum creation CONTEXT. 50 */ 51 void 52 svn_fnv1a_32__update(svn_fnv1a_32__context_t *context, 53 const void *data, 54 apr_size_t len); 55 56 /* Return the FNV-1a checksum over all data fed into CONTEXT. 57 */ 58 apr_uint32_t 59 svn_fnv1a_32__finalize(svn_fnv1a_32__context_t *context); 60 61 62 /* Opaque modified FNV-1a checksum creation context type. 63 */ 64 typedef struct svn_fnv1a_32x4__context_t svn_fnv1a_32x4__context_t; 65 66 /* Return a new modified FNV-1a checksum creation context allocated in POOL. 67 */ 68 svn_fnv1a_32x4__context_t * 69 svn_fnv1a_32x4__context_create(apr_pool_t *pool); 70 71 /* Reset the modified FNV-1a checksum CONTEXT to initial state. 72 */ 73 void 74 svn_fnv1a_32x4__context_reset(svn_fnv1a_32x4__context_t *context); 75 76 /* Feed LEN bytes from DATA into the modified FNV-1a checksum creation 77 * CONTEXT. 78 */ 79 void 80 svn_fnv1a_32x4__update(svn_fnv1a_32x4__context_t *context, 81 const void *data, 82 apr_size_t len); 83 84 /* Return the modified FNV-1a checksum over all data fed into CONTEXT. 85 */ 86 apr_uint32_t 87 svn_fnv1a_32x4__finalize(svn_fnv1a_32x4__context_t *context); 88 89 /* Set HASHES to the 4 partial hash sums produced by the modified FVN-1a 90 * over INPUT of LEN bytes. 91 */ 92 void 93 svn__fnv1a_32x4_raw(apr_uint32_t hashes[4], 94 const void *input, 95 apr_size_t len); 96 97 #ifdef __cplusplus 98 } 99 #endif /* __cplusplus */ 100 101 #endif /* SVN_LIBSVN_SUBR_FNV1A_H */ 102