Subversion Repositories Kolibri OS

Rev

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

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