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
CRC32_HASH_SIZE = 4
-
 
20
 
-
 
21
CRC32_ALIGN = 4
-
 
22
CRC32_ALIGN_MASK = CRC32_ALIGN - 1
-
 
23
 
-
 
24
struct ctx_crc32
-
 
25
        hash    rd 1
-
 
26
ends
-
 
27
 
-
 
28
if defined sizeof.crash_ctx
-
 
29
  assert sizeof.crash_ctx >= sizeof.ctx_crc32
17
 
30
end if
18
 
31
 
19
proc crc32.init _ctx
32
proc crc32.init _ctx
20
        mov     ebx, [_ctx]
33
        mov     ebx, [_ctx]
21
        lea     edi, [ebx + ctx_crc32.hash]
34
        lea     edi, [ebx + ctx_crc32.hash]
Line 59... Line 72...
59
        stosd
72
        stosd
60
        ret
73
        ret
61
endp
74
endp
Line -... Line 75...
-
 
75
 
62
 
76
 
-
 
77
proc crc32.oneshot _ctx, _data, _len
-
 
78
	stdcall	crc32.init, [_ctx]
-
 
79
	stdcall	crc32.update, [_ctx], [_data], [_len]
-
 
80
	stdcall	crc32.final, [_ctx]
-
 
81
	ret
Line -... Line 82...
-
 
82
endp
-
 
83
 
63
 
84
 
Line 64... Line 85...
64
align CRC32_ALIGN
85
iglobal
65
 
86
align CRC32_ALIGN
66
crc32._.hash_init       dd 0xffffffff
87
crc32._.hash_init       dd 0xffffffff
Line 107... Line 128...
107
        0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,\
128
        0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,\
108
        0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\
129
        0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\
109
        0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,\
130
        0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,\
110
        0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,\
131
        0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,\
111
        0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
132
        0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
112
133
endg