Subversion Repositories Kolibri OS

Rev

Rev 6465 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6465 Rev 7698
Line 1... Line 1...
1
;    libcrash -- cryptographic hash functions
1
;    libcrash -- cryptographic hash functions
2
;
2
;
3
;    Copyright (C) 2012-2013,2016 Ivan Baravy (dunkaist)
3
;    Copyright (C) 2012-2013,2016,2019 Ivan Baravy (dunkaist)
4
;
4
;
5
;    This program is free software: you can redistribute it and/or modify
5
;    This program is free software: you can redistribute it and/or modify
6
;    it under the terms of the GNU General Public License as published by
6
;    it under the terms of the GNU General Public License as published by
7
;    the Free Software Foundation, either version 3 of the License, or
7
;    the Free Software Foundation, either version 3 of the License, or
8
;    (at your option) any later version.
8
;    (at your option) any later version.
Line 14... Line 14...
14
;
14
;
15
;    You should have received a copy of the GNU General Public License
15
;    You should have received a copy of the GNU General Public License
16
;    along with this program.  If not, see .
16
;    along with this program.  If not, see .
Line -... Line 17...
-
 
17
 
-
 
18
 
-
 
19
SHA1_HASH_SIZE  = 20
-
 
20
SHA1_BLOCK_SIZE = 64
-
 
21
 
-
 
22
SHA1_ALIGN      = 4
-
 
23
SHA1_ALIGN_MASK = SHA1_ALIGN - 1
-
 
24
 
-
 
25
struct ctx_sha1
-
 
26
        hash            rb SHA1_HASH_SIZE
-
 
27
        block           rb SHA1_BLOCK_SIZE
-
 
28
        index           rd 1
-
 
29
        msglen_0        rd 1
-
 
30
        msglen_1        rd 1
-
 
31
ends
-
 
32
 
-
 
33
if defined sizeof.crash_ctx
-
 
34
  assert sizeof.crash_ctx >= sizeof.ctx_sha1
17
 
35
end if
18
 
36
 
19
proc sha1._.f
37
proc sha1._.f
20
        push    ebx ecx edx
38
        push    ebx ecx edx
21
        xor     ecx, edx
39
        xor     ecx, edx
Line 265... Line 283...
265
        jnz     @b
283
        jnz     @b
266
        ret
284
        ret
267
endp
285
endp
Line -... Line 286...
-
 
286
 
268
 
287
 
-
 
288
proc sha1.oneshot _ctx, _data, _len
-
 
289
	stdcall	sha1.init, [_ctx]
-
 
290
	stdcall	sha1.update, [_ctx], [_data], [_len]
-
 
291
	stdcall	sha1.final, [_ctx]
Line 269... Line -...
269
 
-
 
Line -... Line 292...
-
 
292
	ret
-
 
293
endp
-
 
294
 
-
 
295