2012-12-15 18:23:23 +01:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
db 'MENUET01'
|
2013-03-29 21:13:07 +01:00
|
|
|
dd 0x01,start,i_end,e_end,e_end,0,this_file_name
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
include '../../../../proc32.inc'
|
|
|
|
include '../../../../macros.inc'
|
|
|
|
include '../../../../dll.inc'
|
|
|
|
;include '../../../../debug.inc'
|
|
|
|
include 'libcrash.inc'
|
2013-05-24 17:27:40 +02:00
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
BUFFER_SIZE = 4096
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
start:
|
2016-07-12 23:16:28 +02:00
|
|
|
pushfd
|
|
|
|
pop eax
|
|
|
|
or eax, 1 SHL 18 ; Alignment Check flag
|
|
|
|
push eax
|
|
|
|
popfd
|
2012-12-15 18:23:23 +01:00
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 68, 11
|
|
|
|
|
|
|
|
stdcall dll.Load, @IMPORT
|
|
|
|
or eax, eax
|
|
|
|
jnz quit
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
still:
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 10
|
|
|
|
dec eax
|
|
|
|
jz redraw
|
|
|
|
dec eax
|
|
|
|
jz key
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
button:
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 17
|
|
|
|
shr eax, 8
|
2012-12-15 18:23:23 +01:00
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
cmp eax, 1
|
|
|
|
je quit
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
redraw:
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 12, 1
|
|
|
|
mcall 0, <0,900>, <0,160>, 0x34000000, 0x80000000, window_title
|
2013-05-24 17:27:40 +02:00
|
|
|
|
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 4, < 0, 0>, 0xc0ffffff, message, , 0
|
2013-05-24 17:27:40 +02:00
|
|
|
|
|
|
|
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
|
2016-07-12 23:16:28 +02:00
|
|
|
invoke crash.hash, [hid], data_buffer, update_data_buffer, ctx
|
|
|
|
invoke crash.bin2hex, ctx, hex, [hid]
|
2013-05-24 17:27:40 +02:00
|
|
|
mov ebx, [text_pos_y]
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 4, , 0xc0ffffff, [hash_name], , 0
|
2013-05-24 17:27:40 +02:00
|
|
|
mov ebx, [text_pos_y]
|
|
|
|
add ebx, 66 SHL 16
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 4, , 0x40ffffff, hex, 128, 0
|
2013-05-24 17:27:40 +02:00
|
|
|
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 18:23:23 +01:00
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 12, 2
|
|
|
|
jmp still
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
key:
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall 2
|
|
|
|
jmp still
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
quit:
|
2016-07-12 23:16:28 +02:00
|
|
|
mcall -1
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
|
2013-05-24 17:27:40 +02:00
|
|
|
proc update_data_buffer _left
|
2016-07-12 23:16:28 +02:00
|
|
|
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
|
|
|
|
mcall 70, f70_buf
|
|
|
|
mov eax, ebx
|
|
|
|
cmp eax, -1
|
|
|
|
jne @f
|
|
|
|
inc eax
|
2012-12-15 18:23:23 +01:00
|
|
|
@@:
|
2016-07-12 23:16:28 +02:00
|
|
|
add dword[f70_buf + 4], eax
|
|
|
|
ret
|
2012-12-15 18:23:23 +01:00
|
|
|
endp
|
|
|
|
|
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
szZ window_title ,'libcrash example'
|
2012-12-15 18:23:23 +01:00
|
|
|
|
2013-05-24 17:27:40 +02:00
|
|
|
szZ message , 'hash sums of this file'
|
|
|
|
|
|
|
|
hash_strings:
|
2016-07-12 23:16:28 +02:00
|
|
|
db 'crc32 : ',0
|
|
|
|
db 'md4 : ',0
|
|
|
|
db 'md5 : ',0
|
|
|
|
db 'sha1 : ',0
|
|
|
|
db 'sha224 : ',0
|
|
|
|
db 'sha256 : ',0
|
|
|
|
db 'sha384 : ',0
|
|
|
|
db 'sha512 : ',0
|
|
|
|
db 'sha3-224 : ',0
|
|
|
|
db 'sha3-256 : ',0
|
|
|
|
db 'sha3-384 : ',0
|
|
|
|
db 'sha3-512 : ',0
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
f70_buf:
|
2016-07-12 23:16:28 +02:00
|
|
|
funcnum dd 0
|
|
|
|
src dd 0
|
|
|
|
res1 dd 0
|
|
|
|
count dd BUFFER_SIZE
|
|
|
|
dst dd data_buffer
|
|
|
|
res2 db 0
|
|
|
|
fname dd this_file_name
|
2012-12-15 18:23:23 +01:00
|
|
|
|
2013-05-24 17:27:40 +02:00
|
|
|
|
2012-12-15 18:23:23 +01:00
|
|
|
align 4
|
|
|
|
@IMPORT:
|
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
library \
|
|
|
|
libcrash, 'libcrash.obj'
|
2012-12-15 18:23:23 +01:00
|
|
|
|
2016-07-12 23:16:28 +02:00
|
|
|
import libcrash , \
|
|
|
|
libcrash.init , 'lib_init' , \
|
|
|
|
crash.hash , 'crash_hash' , \
|
|
|
|
crash.bin2hex , 'crash_bin2hex'
|
2012-12-15 18:23:23 +01:00
|
|
|
|
|
|
|
i_end:
|
2013-05-24 17:27:40 +02:00
|
|
|
hash_name rd 1
|
2016-07-12 23:16:28 +02:00
|
|
|
text_pos_y rd 1
|
|
|
|
hash rd 50
|
2013-05-24 17:27:40 +02:00
|
|
|
hid rd 1 ; hash id
|
2016-07-12 23:16:28 +02:00
|
|
|
msglen rd 1
|
|
|
|
hex rb 1024
|
|
|
|
data_buffer rb BUFFER_SIZE
|
|
|
|
this_file_name rb 4096
|
|
|
|
rb 0x800 ;stack
|
|
|
|
align 16 ; should be enough
|
|
|
|
ctx rb 0x1000
|
2012-12-15 18:23:23 +01:00
|
|
|
e_end:
|
|
|
|
|