commit
ecd7d90de2
|
@ -204,7 +204,7 @@ static void OutputTransformation(hashState *ctx) {
|
|||
|
||||
/* initialise context */
|
||||
static void Init(hashState* ctx) {
|
||||
int i = 0;
|
||||
uint32_t i = 0;
|
||||
/* allocate memory for state and data buffer */
|
||||
|
||||
for(;i<(SIZE512/sizeof(uint32_t));i++)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#ifndef __hash_h
|
||||
#define __hash_h
|
||||
#pragma once
|
||||
/*
|
||||
#include "crypto_uint8.h"
|
||||
#include "crypto_uint32.h"
|
||||
|
@ -11,6 +10,7 @@ typedef crypto_uint32 uint32_t;
|
|||
typedef crypto_uint64 uint64_t;
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include "hash.h"
|
||||
|
||||
/* some sizes (number of bytes) */
|
||||
#define ROWS 8
|
||||
|
@ -33,8 +33,6 @@ typedef crypto_uint64 uint64_t;
|
|||
|
||||
|
||||
/* NIST API begin */
|
||||
typedef unsigned char BitSequence;
|
||||
typedef unsigned long long DataLength;
|
||||
typedef struct {
|
||||
uint32_t chaining[SIZE512/sizeof(uint32_t)]; /* actual state */
|
||||
uint32_t block_counter1,
|
||||
|
@ -56,5 +54,3 @@ int crypto_hash(unsigned char *out,
|
|||
const unsigned char *in,
|
||||
unsigned long long len);
|
||||
*/
|
||||
|
||||
#endif /* __hash_h */
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
Last Modified: January 16, 2011
|
||||
*/
|
||||
#pragma once
|
||||
#include "hash.h"
|
||||
|
||||
typedef unsigned char BitSequence;
|
||||
typedef unsigned long long DataLength;
|
||||
typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
|
||||
|
||||
HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
|
||||
|
|
|
@ -1934,8 +1934,8 @@ hashState;
|
|||
|
||||
/* "incremental" hashing API */
|
||||
static SkeinHashReturn Init (hashState *state, int hashbitlen);
|
||||
static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, SkeinDataLength databitlen);
|
||||
static SkeinHashReturn Final (hashState *state, SkeinBitSequence *hashval);
|
||||
static SkeinHashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);
|
||||
static SkeinHashReturn Final (hashState *state, BitSequence *hashval);
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* select the context size and init the context */
|
||||
|
@ -1963,7 +1963,7 @@ static SkeinHashReturn Init(hashState *state, int hashbitlen)
|
|||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* process data to be hashed */
|
||||
static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, SkeinDataLength databitlen)
|
||||
static SkeinHashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen)
|
||||
{
|
||||
/* only the final Update() call is allowed do partial bytes, else assert an error */
|
||||
Skein_Assert((state->u.h.T[1] & SKEIN_T1_FLAG_BIT_PAD) == 0 || databitlen == 0, SKEIN_FAIL);
|
||||
|
@ -2008,7 +2008,7 @@ static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, Sk
|
|||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* finalize hash computation and output the result (hashbitlen bits) */
|
||||
static SkeinHashReturn Final(hashState *state, SkeinBitSequence *hashval)
|
||||
static SkeinHashReturn Final(hashState *state, BitSequence *hashval)
|
||||
{
|
||||
Skein_Assert(state->statebits % 256 == 0 && (state->statebits-256) < 1024,FAIL);
|
||||
switch ((state->statebits >> 8) & 3)
|
||||
|
@ -2022,8 +2022,8 @@ static SkeinHashReturn Final(hashState *state, SkeinBitSequence *hashval)
|
|||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* all-in-one hash function */
|
||||
SkeinHashReturn c_skein_hash(int hashbitlen, const SkeinBitSequence *data, /* all-in-one call */
|
||||
SkeinDataLength databitlen,SkeinBitSequence *hashval)
|
||||
SkeinHashReturn c_skein_hash(int hashbitlen, const BitSequence *data, /* all-in-one call */
|
||||
DataLength databitlen,BitSequence *hashval)
|
||||
{
|
||||
hashState state;
|
||||
SkeinHashReturn r = Init(&state,hashbitlen);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
**
|
||||
***************************************************************************/
|
||||
#include "skein_port.h" /* get platform-specific definitions */
|
||||
#include "hash.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -37,11 +38,8 @@ typedef enum
|
|||
}
|
||||
SkeinHashReturn;
|
||||
|
||||
typedef size_t SkeinDataLength; /* bit count type */
|
||||
typedef u08b_t SkeinBitSequence; /* bit stream type */
|
||||
|
||||
/* "all-in-one" call */
|
||||
SkeinHashReturn c_skein_hash(int hashbitlen, const SkeinBitSequence *data,
|
||||
SkeinDataLength databitlen, SkeinBitSequence *hashval);
|
||||
SkeinHashReturn c_skein_hash(int hashbitlen, const BitSequence *data,
|
||||
DataLength databitlen, BitSequence *hashval);
|
||||
|
||||
#endif /* ifndef _SKEIN_H_ */
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
typedef unsigned char BitSequence;
|
||||
typedef unsigned long long DataLength;
|
|
@ -111,7 +111,7 @@ void cryptonight_hash(const char* input, char* output, uint32_t len) {
|
|||
uint8_t aes_key[AES_KEY_SIZE];
|
||||
OAES_CTX* aes_ctx;
|
||||
|
||||
hash_process(&state.hs, input, len);
|
||||
hash_process(&state.hs, (const uint8_t*) input, len);
|
||||
memcpy(text, state.init, INIT_SIZE_BYTE);
|
||||
memcpy(aes_key, state.hs.b, AES_KEY_SIZE);
|
||||
aes_ctx = oaes_alloc();
|
||||
|
|
2
hefty1.c
2
hefty1.c
|
@ -46,7 +46,7 @@ void hefty1_hash(const char* input, char* output, uint32_t len)
|
|||
|
||||
memset(output, 0, 32);
|
||||
|
||||
char* hash[4] = { &hash32_2, &hash64_3, &hash64_4, &hash64_5 };
|
||||
char* hash[4] = { hash32_2, hash64_3, hash64_4, hash64_5 };
|
||||
|
||||
uint32_t i;
|
||||
uint32_t j;
|
||||
|
|
3
qubit.c
3
qubit.c
|
@ -1,5 +1,8 @@
|
|||
#include "qubit.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sha3/sph_cubehash.h"
|
||||
#include "sha3/sph_luffa.h"
|
||||
#include "sha3/sph_shavite.h"
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
} \
|
||||
|
||||
/* Nothing up my sleeve constants */
|
||||
const static uint32_t K[64] = {
|
||||
static const uint32_t K[64] = {
|
||||
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
|
||||
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
|
||||
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
|
||||
|
@ -82,7 +82,7 @@ const static uint32_t K[64] = {
|
|||
};
|
||||
|
||||
/* Initial hash values */
|
||||
const static uint32_t H[HEFTY1_STATE_WORDS] = {
|
||||
static const uint32_t H[HEFTY1_STATE_WORDS] = {
|
||||
0x6a09e667UL,
|
||||
0xbb67ae85UL,
|
||||
0x3c6ef372UL,
|
||||
|
@ -375,4 +375,4 @@ unsigned char* HEFTY1(const unsigned char *buf, size_t len, unsigned char *diges
|
|||
HEFTY1_Final(digest, &ctx);
|
||||
|
||||
return digest;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "shavite3.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sha3/sph_shavite.h"
|
||||
|
||||
void shavite3_hash(const char* input, char* output, uint32_t len)
|
||||
|
|
Loading…
Reference in New Issue