2012-12-15 21:23:23 +04:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
db 'MENUET01'
|
2013-03-30 00:13:07 +04:00
|
|
|
dd 0x01,start,i_end,e_end,e_end,0,this_file_name
|
2012-12-15 21:23:23 +04:00
|
|
|
|
|
|
|
include '../../../../proc32.inc'
|
|
|
|
include '../../../../macros.inc'
|
|
|
|
include '../../../../dll.inc'
|
|
|
|
;include '../../../../debug.inc'
|
|
|
|
include 'libcrash.inc'
|
2013-05-24 19:27:40 +04:00
|
|
|
|
|
|
|
BUFFER_SIZE = 4096
|
2012-12-15 21:23:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
start:
|
|
|
|
mcall 68, 11
|
|
|
|
|
|
|
|
stdcall dll.Load, @IMPORT
|
|
|
|
or eax, eax
|
|
|
|
jnz quit
|
|
|
|
|
|
|
|
still:
|
|
|
|
mcall 10
|
|
|
|
dec eax
|
|
|
|
jz redraw
|
|
|
|
dec eax
|
|
|
|
jz key
|
|
|
|
|
|
|
|
button:
|
|
|
|
mcall 17
|
|
|
|
shr eax, 8
|
|
|
|
|
|
|
|
cmp eax, 1
|
|
|
|
je quit
|
|
|
|
|
|
|
|
redraw:
|
|
|
|
mcall 12, 1
|
2013-05-24 19:27:40 +04:00
|
|
|
mcall 0, <0,900>, <0,150>, 0x34000000, 0x80000000, window_title
|
|
|
|
|
|
|
|
|
|
|
|
mcall 4, < 0, 0>, 0xc0ffffff, message, , 0
|
|
|
|
|
|
|
|
mov [hid], 0
|
|
|
|
mov [text_pos_y], 10
|
|
|
|
mov [hash_name], hash_strings
|
|
|
|
.next_hash:
|
|
|
|
mov dword[f70_buf + 4], 0
|
|
|
|
mov dword[msglen], 0
|
|
|
|
mov edi, hex
|
|
|
|
xor eax, eax
|
|
|
|
mov ecx, 1024/4
|
|
|
|
rep stosd
|
|
|
|
invoke crash.hash, [hid], hash, data_buffer, 0, update_data_buffer, msglen
|
|
|
|
invoke crash.bin2hex, hash, hex, [hid]
|
|
|
|
mov ebx, [text_pos_y]
|
|
|
|
mcall 4, , 0xc0ffffff, [hash_name], , 0
|
|
|
|
mov ebx, [text_pos_y]
|
|
|
|
add ebx, 66 SHL 16
|
|
|
|
mcall 4, , 0x40ffffff, hex, 128, 0
|
|
|
|
add [text_pos_y], 10
|
|
|
|
add [hash_name], 12 ; lenght of hash_strings item
|
|
|
|
inc [hid]
|
|
|
|
cmp [hid], LIBCRASH_SHA3_512
|
|
|
|
jng .next_hash
|
2012-12-15 21:23:23 +04:00
|
|
|
|
|
|
|
mcall 12, 2
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
key:
|
|
|
|
mcall 2
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
quit:
|
|
|
|
mcall -1
|
|
|
|
|
|
|
|
|
2013-05-24 19:27:40 +04:00
|
|
|
proc update_data_buffer _left
|
|
|
|
mov eax, data_buffer
|
|
|
|
add eax, [_left]
|
|
|
|
mov dword[f70_buf + 16], eax
|
|
|
|
mov eax, BUFFER_SIZE
|
|
|
|
sub eax, [_left]
|
|
|
|
mov dword[f70_buf + 12], eax
|
2012-12-15 21:23:23 +04:00
|
|
|
mcall 70, f70_buf
|
|
|
|
mov eax, ebx
|
|
|
|
cmp eax, -1
|
|
|
|
jne @f
|
|
|
|
inc eax
|
|
|
|
@@:
|
2013-05-24 19:27:40 +04:00
|
|
|
add dword[f70_buf + 4], eax
|
2012-12-15 21:23:23 +04:00
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
|
|
|
|
2013-05-24 19:27:40 +04:00
|
|
|
szZ window_title ,'libcrash example'
|
2012-12-15 21:23:23 +04:00
|
|
|
|
2013-05-24 19:27:40 +04:00
|
|
|
szZ message , 'hash sums of this file'
|
|
|
|
|
|
|
|
hash_strings:
|
|
|
|
md4 db 'md4 : ',0
|
|
|
|
md5 db 'md5 : ',0
|
|
|
|
sha1 db 'sha1 : ',0
|
|
|
|
sha224 db 'sha224 : ',0
|
|
|
|
sha256 db 'sha256 : ',0
|
|
|
|
sha384 db 'sha384 : ',0
|
|
|
|
sha512 db 'sha512 : ',0
|
|
|
|
sha3_224 db 'sha3-224 : ',0
|
|
|
|
sha3_256 db 'sha3-256 : ',0
|
|
|
|
sha3_384 db 'sha3-384 : ',0
|
|
|
|
sha3_512 db 'sha3-512 : ',0
|
2012-12-15 21:23:23 +04:00
|
|
|
|
|
|
|
f70_buf:
|
|
|
|
funcnum dd 0
|
|
|
|
src dd 0
|
|
|
|
res1 dd 0
|
|
|
|
count dd BUFFER_SIZE
|
|
|
|
dst dd data_buffer
|
|
|
|
res2 db 0
|
2013-03-30 00:13:07 +04:00
|
|
|
fname dd this_file_name
|
2012-12-15 21:23:23 +04:00
|
|
|
|
2013-05-24 19:27:40 +04:00
|
|
|
|
2012-12-15 21:23:23 +04:00
|
|
|
align 4
|
|
|
|
@IMPORT:
|
|
|
|
|
|
|
|
library \
|
|
|
|
libcrash, 'libcrash.obj'
|
|
|
|
|
|
|
|
import libcrash , \
|
|
|
|
libcrash.init , 'lib_init' , \
|
|
|
|
crash.hash , 'crash_hash' , \
|
|
|
|
crash.bin2hex , 'crash_bin2hex'
|
|
|
|
|
|
|
|
i_end:
|
2013-05-24 19:27:40 +04:00
|
|
|
hash_name rd 1
|
|
|
|
text_pos_y rd 1
|
|
|
|
hash rd 50
|
|
|
|
hid rd 1 ; hash id
|
2012-12-15 21:23:23 +04:00
|
|
|
msglen rd 1
|
|
|
|
hex rb 1024
|
|
|
|
data_buffer rb BUFFER_SIZE
|
2013-03-30 00:13:07 +04:00
|
|
|
this_file_name rb 4096
|
2013-05-24 19:27:40 +04:00
|
|
|
rb 0x800 ;stack
|
2012-12-15 21:23:23 +04:00
|
|
|
e_end:
|
|
|
|
|