1,6 → 1,6 |
; libcrash -- cryptographic hash functions |
; |
; Copyright (C) 2012-2014,2016 Ivan Baravy (dunkaist) |
; Copyright (C) 2012-2014,2016,2019 Ivan Baravy (dunkaist) |
; |
; This program is free software: you can redistribute it and/or modify |
; it under the terms of the GNU General Public License as published by |
35,141 → 35,47 |
init dd ? |
update dd ? |
final dd ? |
oneshot dd ? |
len_out dd ? |
ends |
|
; CRC32 |
struct crash_ctx |
hash rb 1024 ; context starts with hash data |
ends |
|
|
CRC32_HASH_SIZE = 4 |
CRC32_ALIGN = 4 |
CRC32_ALIGN_MASK = CRC32_ALIGN - 1 |
CRC32_BLOCK_SIZE = 1 |
|
struct ctx_crc32 |
hash rd 1 |
ends |
|
; MD4 |
|
MD4_HASH_SIZE = 16 |
MD4_BLOCK_SIZE = 64 |
MD4_HASH_SIZE = 16 |
MD4_ALIGN = 4 |
MD4_ALIGN_MASK = MD4_ALIGN - 1 |
|
struct ctx_md4 |
hash rb MD4_HASH_SIZE |
block rb MD4_BLOCK_SIZE |
index rd 1 |
msglen_0 rd 1 |
msglen_1 rd 1 |
ends |
|
; MD5 |
|
MD5_HASH_SIZE = 16 |
MD5_BLOCK_SIZE = 64 |
MD5_HASH_SIZE = 16 |
MD5_ALIGN = 4 |
MD5_ALIGN_MASK = MD5_ALIGN - 1 |
|
struct ctx_md5 |
hash rb MD5_HASH_SIZE |
block rb MD5_BLOCK_SIZE |
index rd 1 |
msglen_0 rd 1 |
msglen_1 rd 1 |
ends |
|
; SHA1 |
|
SHA1_HASH_SIZE = 20 |
SHA1_BLOCK_SIZE = 64 |
SHA1_HASH_SIZE = 20 |
SHA1_ALIGN = 4 |
SHA1_ALIGN_MASK = SHA1_ALIGN - 1 |
|
struct ctx_sha1 |
hash rb SHA1_HASH_SIZE |
block rb SHA1_BLOCK_SIZE |
index rd 1 |
msglen_0 rd 1 |
msglen_1 rd 1 |
ends |
SHA224_HASH_SIZE = 28 |
SHA224_BLOCK_SIZE = 64 |
|
; SHA2 |
|
SHA224256_BLOCK_SIZE = 64 |
SHA224256_INIT_SIZE = 32 |
SHA224_HASH_SIZE = 28 |
SHA256_HASH_SIZE = 32 |
SHA224256_ALIGN = 4 |
SHA224256_ALIGN_MASK = SHA224256_ALIGN - 1 |
SHA256_BLOCK_SIZE = 64 |
|
struct ctx_sha224256 |
hash rb SHA224256_INIT_SIZE |
block rb SHA224256_BLOCK_SIZE |
index rd 1 |
msglen_0 rd 1 |
msglen_1 rd 1 |
ends |
SHA384_HASH_SIZE = 48 |
SHA384_BLOCK_SIZE = 128 |
|
SHA384512_BLOCK_SIZE = 128 |
SHA384512_INIT_SIZE = 64 |
|
SHA384_HASH_SIZE = 48 |
SHA512_HASH_SIZE = 64 |
SHA512_BLOCK_SIZE = 128 |
|
SHA384512_ALIGN = 16 |
SHA384512_ALIGN_MASK = SHA384512_ALIGN - 1 |
SHA3_224_HASH_SIZE = 28 |
SHA3_224_BLOCK_SIZE = 144 |
|
struct ctx_sha384512 |
hash rb SHA384512_INIT_SIZE |
block rb SHA384512_BLOCK_SIZE |
index rd 1 |
msglen_0 rd 1 |
msglen_1 rd 1 |
msglen_2 rd 1 |
msglen_3 rd 1 |
rd 3 ; align |
; tmp vars |
w rq 80 |
A rq 1 |
B rq 1 |
C rq 1 |
D rq 1 |
E rq 1 |
F rq 1 |
G rq 1 |
H rq 1 |
temp rq 1 |
ends |
SHA3_256_HASH_SIZE = 32 |
SHA3_256_BLOCK_SIZE = 136 |
|
; SHA3 |
SHA3_384_HASH_SIZE = 48 |
SHA3_384_BLOCK_SIZE = 104 |
|
SHA3224_BLOCK_SIZE = 144 |
SHA3256_BLOCK_SIZE = 136 |
SHA3384_BLOCK_SIZE = 104 |
SHA3512_BLOCK_SIZE = 72 |
SHA3MAX_BLOCK_SIZE = SHA3224_BLOCK_SIZE |
|
SHA3_INIT_SIZE = 200 |
|
SHA3224_HASH_SIZE = 28 |
SHA3256_HASH_SIZE = 32 |
SHA3384_HASH_SIZE = 48 |
SHA3512_HASH_SIZE = 64 |
|
SHA3_ALIGN = 16 |
SHA3_ALIGN_MASK = SHA3_ALIGN-1 |
|
struct ctx_sha3 |
hash rb SHA3_INIT_SIZE |
rb SHA3_ALIGN - (SHA3_INIT_SIZE mod SHA3_ALIGN) |
block rb SHA3MAX_BLOCK_SIZE |
rb SHA3_ALIGN - (SHA3MAX_BLOCK_SIZE mod SHA3_ALIGN) |
index rd 1 |
block_size rd 1 |
rounds_cnt rd 1 |
rd 1 ; align |
; tmp vars |
C rq 5 |
D rq 5 |
ends |
|
SHA3_512_HASH_SIZE = 64 |
SHA3_512_BLOCK_SIZE = 72 |