/programs/develop/libraries/libcrash/trunk/crashtest.asm |
---|
100,7 → 100,6 |
szZ window_title ,'libcrash example' |
szZ message , 'hash sums of this file' |
hash_strings: |
/programs/develop/libraries/libcrash/trunk/crc32.asm |
---|
16,15 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
CRC32_HASH_SIZE = 4 |
CRC32_ALIGN = 4 |
CRC32_ALIGN_MASK = CRC32_ALIGN - 1 |
struct ctx_crc32 |
hash rd 1 |
ends |
proc crc32.init _ctx |
mov ebx, [_ctx] |
lea edi, [ebx + ctx_crc32.hash] |
/programs/develop/libraries/libcrash/trunk/libcrash.asm |
---|
110,14 → 110,14 |
md4.init, md4.update, md4.final, MD4_HASH_SIZE, \ |
md5.init, md5.update, md5.final, MD5_HASH_SIZE, \ |
sha1.init, sha1.update, sha1.final, SHA1_HASH_SIZE, \ |
sha224.init, sha224256.update, sha224256.final, SHA224_HASH_SIZE, \ |
sha256.init, sha224256.update, sha224256.final, SHA256_HASH_SIZE, \ |
sha384.init, sha384512.update, sha384512.final, SHA384_HASH_SIZE, \ |
sha512.init, sha384512.update, sha384512.final, SHA512_HASH_SIZE, \ |
sha3224.init, sha3.update, sha3.final, SHA3224_HASH_SIZE,\ |
sha3256.init, sha3.update, sha3.final, SHA3256_HASH_SIZE,\ |
sha3384.init, sha3.update, sha3.final, SHA3384_HASH_SIZE,\ |
sha3512.init, sha3.update, sha3.final, SHA3512_HASH_SIZE |
sha224.init, sha224.update, sha224.final, SHA224_HASH_SIZE, \ |
sha256.init, sha256.update, sha256.final, SHA256_HASH_SIZE, \ |
sha384.init, sha384.update, sha384.final, SHA384_HASH_SIZE, \ |
sha512.init, sha512.update, sha512.final, SHA512_HASH_SIZE, \ |
sha3224.init, sha3224.update, sha3224.final, SHA3224_HASH_SIZE,\ |
sha3256.init, sha3256.update, sha3256.final, SHA3256_HASH_SIZE,\ |
sha3384.init, sha3384.update, sha3384.final, SHA3384_HASH_SIZE,\ |
sha3512.init, sha3512.update, sha3512.final, SHA3512_HASH_SIZE |
align 4 |
@EXPORT: |
125,5 → 125,40 |
export \ |
lib_init , 'lib_init' , \ |
crash.hash , 'crash_hash' , \ |
crash.bin2hex , 'crash_bin2hex' |
crash.bin2hex, 'crash_bin2hex' , \ |
crc32.init, 'crc32_init' , \ |
crc32.update, 'crc32_update' , \ |
crc32.final, 'crc32_final' , \ |
md4.init, 'md4_init' , \ |
md4.update, 'md4_update' , \ |
md4.final, 'md4_final' , \ |
md5.init, 'md5_init' , \ |
md5.update, 'md5_update' , \ |
md5.final, 'md5_final' , \ |
sha1.init, 'sha1_init' , \ |
sha1.update, 'sha1_update' , \ |
sha1.final, 'sha1_final' , \ |
sha224.init, 'sha224_init' , \ |
sha224.update, 'sha224_update' , \ |
sha224.final, 'sha224_final' , \ |
sha256.init, 'sha256_init' , \ |
sha256.update, 'sha256_update' , \ |
sha256.final, 'sha256_final' , \ |
sha384.init, 'sha384_init' , \ |
sha384.update, 'sha384_update' , \ |
sha384.final, 'sha384_final' , \ |
sha512.init, 'sha512_init' , \ |
sha512.update, 'sha512_update' , \ |
sha512.final, 'sha512_final' , \ |
sha3224.init, 'sha3_224_init' , \ |
sha3224.update, 'sha3_224_update' , \ |
sha3224.final, 'sha3_224_final' , \ |
sha3256.init, 'sha3_256_init' , \ |
sha3256.update, 'sha3_256_update' , \ |
sha3256.final, 'sha3_256_final' , \ |
sha3384.init, 'sha3_384_init' , \ |
sha3384.update, 'sha3_384_update' , \ |
sha3384.final, 'sha3_384_final' , \ |
sha3512.init, 'sha3_512_init' , \ |
sha3512.update, 'sha3_512_update' , \ |
sha3512.final, 'sha3_512_final' |
/programs/develop/libraries/libcrash/trunk/libcrash.inc |
---|
38,3 → 38,138 |
len_out dd ? |
ends |
; CRC32 |
CRC32_HASH_SIZE = 4 |
CRC32_ALIGN = 4 |
CRC32_ALIGN_MASK = CRC32_ALIGN - 1 |
struct ctx_crc32 |
hash rd 1 |
ends |
; MD4 |
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_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_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 |
; 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 |
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 |
SHA384512_BLOCK_SIZE = 128 |
SHA384512_INIT_SIZE = 64 |
SHA384_HASH_SIZE = 48 |
SHA512_HASH_SIZE = 64 |
SHA384512_ALIGN = 16 |
SHA384512_ALIGN_MASK = SHA384512_ALIGN - 1 |
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 |
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 |
/programs/develop/libraries/libcrash/trunk/md4.asm |
---|
16,20 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
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 |
macro md4._.f b, c, d |
{ |
mov eax, c |
/programs/develop/libraries/libcrash/trunk/md5.asm |
---|
16,20 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
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 |
macro md5._.f b, c, d |
{ |
push c |
/programs/develop/libraries/libcrash/trunk/sha1.asm |
---|
16,20 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
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 |
proc sha1._.f |
push ebx ecx edx |
xor ecx, edx |
/programs/develop/libraries/libcrash/trunk/sha224_256.asm |
---|
16,22 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
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 |
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 |
macro sha224256._.chn x, y, z |
{ |
mov eax, [y] |
269,8 → 253,8 |
ret |
endp |
proc sha224256.update _ctx, _msg, _size |
sha256.update = sha224.update |
proc sha224.update _ctx, _msg, _size |
mov ebx, [_ctx] |
mov ecx, [_size] |
add [ebx + ctx_sha224256.msglen_0], ecx |
326,7 → 310,8 |
endp |
proc sha224256.final _ctx |
sha256.final = sha224.final |
proc sha224.final _ctx |
mov ebx, [_ctx] |
lea edi, [ebx + ctx_sha224256.block] |
mov ecx, [ebx + ctx_sha224256.msglen_0] |
/programs/develop/libraries/libcrash/trunk/sha3.asm |
---|
16,37 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
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 |
macro sha3._.rol_xor nd, ncl, ncr |
{ |
movq mm0, [C + 8*(ncl)] |
324,6 → 293,10 |
endp |
sha3224.update = sha3.update |
sha3256.update = sha3.update |
sha3384.update = sha3.update |
sha3512.update = sha3.update |
proc sha3.update _ctx, _msg, _size |
.next_block: |
mov ebx, [_ctx] |
382,6 → 355,10 |
endp |
sha3224.final = sha3.final |
sha3256.final = sha3.final |
sha3384.final = sha3.final |
sha3512.final = sha3.final |
proc sha3.final _ctx |
pushad |
mov ebx, [_ctx] |
/programs/develop/libraries/libcrash/trunk/sha384_512.asm |
---|
16,38 → 16,6 |
; along with this program. If not, see <http://www.gnu.org/licenses/>. |
SHA384512_BLOCK_SIZE = 128 |
SHA384512_INIT_SIZE = 64 |
SHA384_HASH_SIZE = 48 |
SHA512_HASH_SIZE = 64 |
SHA384512_ALIGN = 16 |
SHA384512_ALIGN_MASK = SHA384512_ALIGN - 1 |
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 |
macro sha384512._.chn x, y, z |
{ |
movq mm0, [y] |
350,8 → 318,8 |
restore w,A,B,C,D,E,F,G,H,temp |
endp |
proc sha384512.update _ctx, _msg, _size |
sha512.update = sha384.update |
proc sha384.update _ctx, _msg, _size |
mov ebx, [_ctx] |
mov ecx, [_size] |
add [ebx + ctx_sha384512.msglen_0], ecx |
409,7 → 377,8 |
endp |
proc sha384512.final _ctx |
sha512.final = sha384.final |
proc sha384.final _ctx |
mov ebx, [_ctx] |
lea edi, [ebx + ctx_sha384512.block] |
mov ecx, [ebx + ctx_sha384512.msglen_0] |
/programs/develop/libraries/libcrash/trunk |
---|
Property changes: |
Added: svn:ignore |
+libcrash.obj |