aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/groestl.h
diff options
context:
space:
mode:
authorAntonio Juarez <antonio.maria.juarez@live.com>2014-03-03 22:07:58 +0000
committerAntonio Juarez <antonio.maria.juarez@live.com>2014-03-03 22:07:58 +0000
commit296ae46ed8f8f6e5f986f978febad302e3df231a (patch)
tree1629164454a239308f33c9e12afb22e7f3cd8eeb /src/crypto/groestl.h
parentchanged name (diff)
downloadmonero-296ae46ed8f8f6e5f986f978febad302e3df231a.tar.xz
moved all stuff to github
Diffstat (limited to 'src/crypto/groestl.h')
-rw-r--r--src/crypto/groestl.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/crypto/groestl.h b/src/crypto/groestl.h
new file mode 100644
index 000000000..078515cee
--- /dev/null
+++ b/src/crypto/groestl.h
@@ -0,0 +1,60 @@
+#ifndef __hash_h
+#define __hash_h
+/*
+#include "crypto_uint8.h"
+#include "crypto_uint32.h"
+#include "crypto_uint64.h"
+#include "crypto_hash.h"
+
+typedef crypto_uint8 uint8_t;
+typedef crypto_uint32 uint32_t;
+typedef crypto_uint64 uint64_t;
+*/
+#include <stdint.h>
+
+/* some sizes (number of bytes) */
+#define ROWS 8
+#define LENGTHFIELDLEN ROWS
+#define COLS512 8
+
+#define SIZE512 (ROWS*COLS512)
+
+#define ROUNDS512 10
+#define HASH_BIT_LEN 256
+
+#define ROTL32(v, n) ((((v)<<(n))|((v)>>(32-(n))))&li_32(ffffffff))
+
+
+#define li_32(h) 0x##h##u
+#define EXT_BYTE(var,n) ((uint8_t)((uint32_t)(var) >> (8*n)))
+#define u32BIG(a) \
+ ((ROTL32(a,8) & li_32(00FF00FF)) | \
+ (ROTL32(a,24) & li_32(FF00FF00)))
+
+
+/* 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,
+ block_counter2; /* message block counter(s) */
+ BitSequence buffer[SIZE512]; /* data buffer */
+ int buf_ptr; /* data buffer pointer */
+ int bits_in_last_byte; /* no. of message bits in last byte of
+ data buffer */
+} hashState;
+
+/*void Init(hashState*);
+void Update(hashState*, const BitSequence*, DataLength);
+void Final(hashState*, BitSequence*); */
+void groestl(const BitSequence*, DataLength, BitSequence*);
+/* NIST API end */
+
+/*
+int crypto_hash(unsigned char *out,
+ const unsigned char *in,
+ unsigned long long len);
+*/
+
+#endif /* __hash_h */