Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
photon-beetle-hash.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Southern Storm Software, Pty Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef LWCRYPTO_PHOTON_BEETLE_HASH_H
24 #define LWCRYPTO_PHOTON_BEETLE_HASH_H
25 
26 #include <stddef.h>
27 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
46 #define PHOTON_BEETLE_HASH_SIZE 32
47 
51 typedef union
52 {
53  struct {
54  unsigned char state[32];
55  unsigned char posn;
56  unsigned char rate;
57  unsigned char first;
58  } s;
59  unsigned long long align;
62 
78  (unsigned char *out, const unsigned char *in, size_t inlen);
79 
89 
100  (photon_beetle_hash_state_t *state, const unsigned char *in, size_t inlen);
101 
113  (photon_beetle_hash_state_t *state, unsigned char *out);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif
void photon_beetle_hash_init(photon_beetle_hash_state_t *state)
Initializes the state for a Photon-Beetle-HASH hashing operation.
Definition: photon-beetle-hash.c:96
int photon_beetle_hash(unsigned char *out, const unsigned char *in, size_t inlen)
Hashes a block of input data with PHOTON-Beetle-HASH to generate a hash value.
Definition: photon-beetle-hash.c:42
unsigned char posn
Definition: photon-beetle-hash.h:55
unsigned char rate
Definition: photon-beetle-hash.h:56
State information for the PHOTON-Beetle-HASH incremental mode.
Definition: photon-beetle-hash.h:51
unsigned char first
Definition: photon-beetle-hash.h:57
void photon_beetle_hash_update(photon_beetle_hash_state_t *state, const unsigned char *in, size_t inlen)
Updates a Photon-Beetle-HASH state with more input data.
Definition: photon-beetle-hash.c:105
unsigned long long align
Definition: photon-beetle-hash.h:59
void photon_beetle_hash_finalize(photon_beetle_hash_state_t *state, unsigned char *out)
Returns the final hash value from a Photon-Beetle-HASH hashing operation.
Definition: photon-beetle-hash.c:127