1,6 → 1,6 |
; libcrash -- cryptographic hash functions |
; |
; Copyright (C) 2012-2013,2016 Ivan Baravy (dunkaist) |
; Copyright (C) 2012-2013,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 |
16,6 → 16,24 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
SHA1_HASH_SIZE = 20 |
SHA1_BLOCK_SIZE = 64 |
|
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 |
|
if defined sizeof.crash_ctx |
assert sizeof.crash_ctx >= sizeof.ctx_sha1 |
end if |
|
proc sha1._.f |
push ebx ecx edx |
xor ecx, edx |
267,7 → 285,15 |
endp |
|
|
proc sha1.oneshot _ctx, _data, _len |
stdcall sha1.init, [_ctx] |
stdcall sha1.update, [_ctx], [_data], [_len] |
stdcall sha1.final, [_ctx] |
ret |
endp |
|
|
iglobal |
align SHA1_ALIGN |
|
sha1._.hash_init dd 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 |
|
endg |