summaryrefslogtreecommitdiff
path: root/source/kit/sha256.h
blob: 182ee800b2d0291cfca79451e778ebefc2042176 (plain)
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
#ifndef KIT_SHA256_H
#define KIT_SHA256_H

#ifndef _GNU_SOURCE
#  define _GNU_SOURCE
#endif

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

enum { KIT_SHA256_BLOCK_SIZE = 32 };

typedef struct {
  uint8_t v[KIT_SHA256_BLOCK_SIZE];
} kit_sha256_hash_t;

kit_sha256_hash_t kit_sha256(ptrdiff_t size, uint8_t *data);

#ifdef __cplusplus
}
#endif

#ifndef KIT_DISABLE_SHORT_NAMES
#  define SHA256_BLOCK_SIZE KIT_SHA256_BLOCK_SIZE
#  define sha256_hash_t kit_sha256_hash_t
#  define sha256 kit_sha256
#endif

#endif