Merge pull request #1226 from DoZ10/master

Blake2b raw hash implementation
This commit is contained in:
Jens Steube
2017-05-03 16:38:03 +02:00
committed by GitHub
16 changed files with 1347 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _CPU_BLAKE2_H
#define _CPU_BLAKE2_H
#include <string.h>
const u64 blake2b_IV[8] =
{
0x6a09e667f3bcc908, 0xbb67ae8584caa73b,
0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
0x510e527fade682d1, 0x9b05688c2b3e6c1f,
0x1f83d9abfb41bd6b, 0x5be0cd19137e2179
};
#endif // _CPU_BLAKE2_H
+5
View File
@@ -910,6 +910,8 @@ typedef enum display_len
DISPLAY_LEN_MIN_501 = 104,
DISPLAY_LEN_MAX_500 = 3 + 1 + 8 + 22,
DISPLAY_LEN_MAX_501 = 104,
DISPLAY_LEN_MIN_600 = 8 + 128,
DISPLAY_LEN_MAX_600 = 8 + 128,
DISPLAY_LEN_MIN_900 = 32,
DISPLAY_LEN_MAX_900 = 32,
DISPLAY_LEN_MIN_910 = 32 + 1 + 0,
@@ -1326,6 +1328,7 @@ typedef enum hash_type
HASH_TYPE_ITUNES_BACKUP_9 = 56,
HASH_TYPE_ITUNES_BACKUP_10 = 57,
HASH_TYPE_SKIP32 = 58,
HASH_TYPE_BLAKE2B = 59,
} hash_type_t;
@@ -1349,6 +1352,7 @@ typedef enum kern_type
KERN_TYPE_MYSQL41 = 300,
KERN_TYPE_PHPASS = 400,
KERN_TYPE_MD5CRYPT = 500,
KERN_TYPE_BLAKE2B = 600,
KERN_TYPE_MD4 = 900,
KERN_TYPE_MD4_PWU = 1000,
KERN_TYPE_MD44_PWUSLT = 1100,
@@ -1604,6 +1608,7 @@ int joomla_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu
int postgresql_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int netscreen_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int keccak_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int blake2b_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int lm_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int md4_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
int md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED const hashconfig_t *hashconfig);
+28
View File
@@ -664,6 +664,34 @@ typedef enum user_options_map
* structs
*/
typedef struct
{
u8 digest_length;
u8 key_length;
u8 fanout;
u8 depth;
u32 leaf_length;
u32 node_offset;
u32 xof_length;
u8 node_depth;
u8 inner_length;
u8 reserved[14];
u8 salt[16];
u8 personnel[16];
} blake2params_t;
typedef struct
{
u64 h[8];
u64 t[2];
u64 f[2];
u32 buflen;
u32 outlen;
u8 last_node;
} blake2_t;
typedef struct
{
u32 salt_buf[16];