fnv1a.h revision 299742
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 32extern "C" { 33#endif /* __cplusplus */ 34 35/* Opaque FNV-1a checksum creation context type. 36 */ 37typedef 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 */ 41svn_fnv1a_32__context_t * 42svn_fnv1a_32__context_create(apr_pool_t *pool); 43 44/* Feed LEN bytes from DATA into the FNV-1a checksum creation CONTEXT. 45 */ 46void 47svn_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 */ 53apr_uint32_t 54svn_fnv1a_32__finalize(svn_fnv1a_32__context_t *context); 55 56 57/* Opaque modified FNV-1a checksum creation context type. 58 */ 59typedef 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 */ 63svn_fnv1a_32x4__context_t * 64svn_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 */ 69void 70svn_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 */ 76apr_uint32_t 77svn_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 */ 82void 83svn__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 */ 92