00001 /** @file 00002 00003 @section license License 00004 00005 Licensed to the Apache Software Foundation (ASF) under one 00006 or more contributor license agreements. See the NOTICE file 00007 distributed with this work for additional information 00008 regarding copyright ownership. The ASF licenses this file 00009 to you under the Apache License, Version 2.0 (the 00010 "License"); you may not use this file except in compliance 00011 with the License. You may obtain a copy of the License at 00012 00013 http://www.apache.org/licenses/LICENSE-2.0 00014 00015 Unless required by applicable law or agreed to in writing, software 00016 distributed under the License is distributed on an "AS IS" BASIS, 00017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 See the License for the specific language governing permissions and 00019 limitations under the License. 00020 */ 00021 00022 #ifndef __HASH_SIP_H__ 00023 #define __HASH_SIP_H__ 00024 00025 #include "Hash.h" 00026 #include <stdint.h> 00027 00028 /* 00029 Siphash is a Hash Message Authentication Code and can take a key. 00030 00031 If you don't care about MAC use the void constructor and it will use 00032 a zero key for you. 00033 */ 00034 00035 struct ATSHash64Sip24:ATSHash64 00036 { 00037 ATSHash64Sip24(void); 00038 ATSHash64Sip24(const unsigned char key[16]); 00039 ATSHash64Sip24(uint64_t key0, uint64_t key1); 00040 void update(const void *data, size_t len); 00041 void final(void); 00042 uint64_t get(void) const; 00043 void clear(void); 00044 00045 private: 00046 unsigned char block_buffer[8]; 00047 uint8_t block_buffer_len; 00048 uint64_t k0, k1, v0, v1, v2, v3, hfinal; 00049 size_t total_len; 00050 bool finalized; 00051 }; 00052 00053 #endif