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
|
#define crypto_hash(out, in, inlen) crypto_blake2b(out, in, inlen)
#define blake2b(out, outlen, in, inlen, key, keylen) 0, crypto_blake2b_general(out, outlen, key, keylen, in, inlen)
#define blake2b_state crypto_blake2b_ctx
#define blake2b_init(ctx, outlen) 0; crypto_blake2b_general_init(ctx, outlen, NULL, 0)
#define blake2b_update(ctx, in, inlen) 0; crypto_blake2b_update(ctx, in, inlen)
#define blake2b_final(ctx, out, ignore1) 0; crypto_blake2b_final(ctx, out)
#define BLAKE2_INLINE
#define BLAKE2B_OUTBYTES 64
#include <stdint.h>
#include <tcl.h>
#include "monocypher.h"
static BLAKE2_INLINE uint64_t rotr64(uint64_t x, uint64_t n) { return (x >> n) ^ (x << (64 - n)); }
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
#endif
}
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
|
>
|
>
>
|
>
<
>
>
>
|
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
|
#define crypto_hash(out, in, inlen) crypto_blake2b(out, in, inlen)
#define blake2b(out, outlen, in, inlen, key, keylen) 0, crypto_blake2b_general(out, outlen, key, keylen, in, inlen)
#define blake2b_state crypto_blake2b_ctx
#define blake2b_init(ctx, outlen) 0; crypto_blake2b_general_init(ctx, outlen, NULL, 0)
#define blake2b_update(ctx, in, inlen) 0; crypto_blake2b_update(ctx, in, inlen)
#define blake2b_final(ctx, out, ignore1) 0; crypto_blake2b_final(ctx, out)
#ifndef BLAKE2_INLINE
# define BLAKE2_INLINE
#endif
#ifndef BLAKE2B_OUTBYTES
# define BLAKE2B_OUTBYTES 64
#endif
#include <stdint.h>
#include <tcl.h>
#include "monocypher.h"
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
#endif
}
#ifndef TCL_NANO_AMALGAMATION
static BLAKE2_INLINE uint64_t rotr64(uint64_t x, uint64_t n) { return (x >> n) ^ (x << (64 - n)); }
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
|