blake2b256.h
Go to the documentation of this file.
1 /**
2  * @file blake2b256.h
3  * @brief BLAKE2b-256 hash function
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneCrypto Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _BLAKE2B256_H
30 #define _BLAKE2B256_H
31 
32 //Dependencies
33 #include "core/crypto.h"
34 #include "hash/blake2b.h"
35 
36 //BLAKE2b-256 block size
37 #define BLAKE2B256_BLOCK_SIZE 128
38 //BLAKE2b-256 digest size
39 #define BLAKE2B256_DIGEST_SIZE 32
40 //BLAKE2b-256 algorithm object identifier
41 #define BLAKE2B256_OID blake2b256Oid
42 //Common interface for hash algorithms
43 #define BLAKE2B256_HASH_ALGO (&blake2b256HashAlgo)
44 
45 //C++ guard
46 #ifdef __cplusplus
47  extern "C" {
48 #endif
49 
50 
51 /**
52  * @brief BLAKE2b-256 algorithm context
53  **/
54 
56 
57 
58 //BLAKE2b-256 related constants
59 extern const uint8_t blake2b256Oid[11];
60 extern const HashAlgo blake2b256HashAlgo;
61 
62 //BLAKE2b-256 related functions
63 error_t blake2b256Compute(const void *data, size_t length, uint8_t *digest);
64 void blake2b256Init(Blake2b256Context *context);
65 void blake2b256Update(Blake2b256Context *context, const void *data, size_t length);
66 void blake2b256Final(Blake2b256Context *context, uint8_t *digest);
67 
68 //C++ guard
69 #ifdef __cplusplus
70  }
71 #endif
72 
73 #endif
void blake2b256Update(Blake2b256Context *context, const void *data, size_t length)
Update BLAKE2b-256 hash computation.
Definition: blake2b256.c:92
General definitions for cryptographic algorithms.
const HashAlgo blake2b256HashAlgo
Definition: blake2b256.c:43
BLAKE2 cryptographic hash and MAC (BLAKE2b variant)
void blake2b256Final(Blake2b256Context *context, uint8_t *digest)
Finish BLAKE2b-256 hash computation.
Definition: blake2b256.c:105
const uint8_t blake2b256Oid[11]
Definition: blake2b256.c:40
void blake2b256Init(Blake2b256Context *context)
Initialize BLAKE2b-256 hash computation.
Definition: blake2b256.c:78
error_t blake2b256Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using BLAKE2b-256.
Definition: blake2b256.c:66
error_t
Error codes.
Definition: error.h:40
uint8_t data[]
Definition: dtls_misc.h:167
BLAKE2b algorithm context.
Definition: blake2b.h:48
Blake2bContext Blake2b256Context
BLAKE2b-256 algorithm context.
Definition: blake2b256.h:55
Common interface for hash algorithms.
Definition: crypto.h:1054
uint8_t length
Definition: dtls_misc.h:140