Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
tpruvot
GitHub Repository: tpruvot/cpuminer-multi
Path: blob/linux/crypto/blake2b.h
1201 views
1
#pragma once
2
#ifndef __BLAKE2B_H__
3
#define __BLAKE2B_H__
4
5
#include <stddef.h>
6
#include <stdint.h>
7
8
#if defined(_MSC_VER)
9
#include <inttypes.h>
10
#define inline __inline
11
#define ALIGN(x) __declspec(align(x))
12
#else
13
#define ALIGN(x) __attribute__((aligned(x)))
14
#endif
15
16
#if defined(_MSC_VER) || defined(__x86_64__) || defined(__x86__)
17
#define NATIVE_LITTLE_ENDIAN
18
#endif
19
20
// state context
21
ALIGN(64) typedef struct {
22
uint8_t b[128]; // input buffer
23
uint64_t h[8]; // chained state
24
uint64_t t[2]; // total number of bytes
25
size_t c; // pointer for b[]
26
size_t outlen; // digest size
27
} blake2b_ctx;
28
29
#if defined(__cplusplus)
30
extern "C" {
31
#endif
32
33
int blake2b_init(blake2b_ctx *ctx, size_t outlen, const void *key, size_t keylen);
34
void blake2b_update(blake2b_ctx *ctx, const void *in, size_t inlen);
35
void blake2b_final(blake2b_ctx *ctx, void *out);
36
37
#if defined(__cplusplus)
38
}
39
#endif
40
41
#endif
42
43