-
Notifications
You must be signed in to change notification settings - Fork 0
/
nl_hash_templ.h
50 lines (43 loc) · 1.23 KB
/
nl_hash_templ.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef NANO_LIB_HASH_H__
#define NANO_LIB_HASH_H__
/*****
* Copy this file to the parenting components directory to define a custom
* blake2b hashing implementation.
*/
#include "stddef.h"
#include "stdint.h"
/* Hashing context type */
typedef void nl_hash_ctx_t;
/**
* @brief Initialize hashing context.
* @param[in] ctx Outputs an initialized hashing context.
* @param[in] hash_len Length of hash digest in bytes.
* @return 0 on success.
*/
static inline int nl_hash_init(nl_hash_ctx_t *ctx, uint8_t hash_len)
{
return -1;
}
/**
* @brief Update hashing context.
* @param[in] ctx Outputs an initialized hashing context.
* @param[in] msg Message to hash
* @param[in] msg_len Length of input msg in bytes.
* @return 0 on success.
*/
static inline int nl_hash_update(nl_hash_ctx_t *ctx, const uint8_t *msg, size_t msg_len)
{
return -1;
}
/**
* @brief Finalize hashing context.
* @param[in] ctx Outputs an initialized hashing context.
* @param[out] hash Buffer to store the output digest. Must be same length as passed in nl_hash_init.
* @param[out] hash_len Length of output hash buffer.
* @return 0 on success.
*/
static inline int nl_hash_final(nl_hash_ctx_t *ctx, uint8_t *hash, uint8_t hash_len)
{
return -1;
}
#endif