Subversion Repositories Kolibri OS

Rev

Rev 3431 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3115 dunkaist 1
use32
2
    org 0x0
3
    db  'MENUET01'
3431 dunkaist 4
    dd  0x01,start,i_end,e_end,e_end,0,this_file_name
3115 dunkaist 5
 
6
include '../../../../proc32.inc'
7
include '../../../../macros.inc'
8
include '../../../../dll.inc'
9
;include '../../../../debug.inc'
10
include 'libcrash.inc'
11
 
3532 dunkaist 12
BUFFER_SIZE	= 4096
3115 dunkaist 13
 
3532 dunkaist 14
 
3115 dunkaist 15
start:
16
	mcall	68, 11
17
 
18
	stdcall dll.Load, @IMPORT
19
	or	eax, eax
20
	jnz	quit
21
 
22
still:
23
	mcall	10
24
	dec	eax
25
	jz	redraw
26
	dec	eax
27
	jz	key
28
 
29
button:
30
	mcall	17
31
	shr	eax, 8
32
 
33
	cmp	eax, 1
34
	je	quit
35
 
36
redraw:
37
	mcall	12, 1
3532 dunkaist 38
	mcall	0, <0,900>, <0,150>, 0x34000000, 0x80000000, window_title
3115 dunkaist 39
 
40
 
3532 dunkaist 41
	mcall	4, < 0,  0>, 0xc0ffffff, message, , 0
42
 
43
        mov     [hid], 0
44
        mov     [text_pos_y], 10
45
        mov     [hash_name], hash_strings
46
  .next_hash:
47
        mov     dword[f70_buf + 4], 0
48
        mov     dword[msglen], 0
49
        mov     edi, hex
50
        xor     eax, eax
51
        mov     ecx, 1024/4
52
        rep     stosd
53
	invoke	crash.hash, [hid], hash, data_buffer, 0, update_data_buffer, msglen
54
	invoke	crash.bin2hex, hash, hex, [hid]
55
        mov     ebx, [text_pos_y]
56
	mcall	4, , 0xc0ffffff, [hash_name],    , 0
57
        mov     ebx, [text_pos_y]
58
        add     ebx, 66 SHL 16
59
	mcall	4, , 0x40ffffff, hex, 128, 0
60
        add     [text_pos_y], 10
61
        add     [hash_name], 12 ; lenght of hash_strings item
62
        inc     [hid]
63
        cmp     [hid], LIBCRASH_SHA3_512
64
        jng     .next_hash
65
 
3115 dunkaist 66
	mcall	12, 2
67
	jmp	still
68
 
69
key:
70
	mcall	2
71
	jmp	still
72
 
73
 
74
quit:
75
	mcall	-1
76
 
77
 
3532 dunkaist 78
proc update_data_buffer _left
79
	mov	eax, data_buffer
80
	add	eax, [_left]
81
	mov	dword[f70_buf + 16], eax
82
	mov	eax, BUFFER_SIZE
83
	sub	eax, [_left]
84
	mov	dword[f70_buf + 12], eax
3115 dunkaist 85
	mcall	70, f70_buf
86
	mov	eax, ebx
87
	cmp	eax, -1
88
	jne	@f
89
	inc	eax
90
    @@:
3532 dunkaist 91
	add	dword[f70_buf + 4], eax
3115 dunkaist 92
	ret
93
endp
94
 
95
 
3532 dunkaist 96
szZ window_title	,'libcrash example'
3115 dunkaist 97
 
3532 dunkaist 98
szZ message             , 'hash sums of this file'
3115 dunkaist 99
 
3532 dunkaist 100
hash_strings:
101
md4        db 'md4      : ',0
102
md5        db 'md5      : ',0
103
sha1       db 'sha1     : ',0
104
sha224     db 'sha224   : ',0
105
sha256     db 'sha256   : ',0
106
sha384     db 'sha384   : ',0
107
sha512     db 'sha512   : ',0
108
sha3_224   db 'sha3-224 : ',0
109
sha3_256   db 'sha3-256 : ',0
110
sha3_384   db 'sha3-384 : ',0
111
sha3_512   db 'sha3-512 : ',0
112
 
3115 dunkaist 113
f70_buf:
114
	funcnum	dd 0
115
	src	dd 0
116
	res1	dd 0
117
	count	dd BUFFER_SIZE
118
	dst	dd data_buffer
119
	res2	db 0
3431 dunkaist 120
	fname	dd this_file_name
3115 dunkaist 121
 
3532 dunkaist 122
 
3115 dunkaist 123
align 4
124
@IMPORT:
125
 
126
library				  \
127
	libcrash, 'libcrash.obj'
128
 
129
import	libcrash			, \
130
	libcrash.init  , 'lib_init'	, \
131
	crash.hash     , 'crash_hash'	, \
132
	crash.bin2hex  , 'crash_bin2hex'
133
 
134
i_end:
3532 dunkaist 135
hash_name       rd 1
136
text_pos_y	rd 1
137
hash		rd 50
138
hid             rd 1    ; hash id
3115 dunkaist 139
msglen		rd 1
140
hex		rb 1024
141
data_buffer	rb BUFFER_SIZE
3431 dunkaist 142
this_file_name	rb 4096
3532 dunkaist 143
rb 0x800					;stack
3115 dunkaist 144
e_end:
145