Subversion Repositories Kolibri OS

Rev

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

Rev 3431 Rev 6461
Line 1... Line 1...
1
;    libcrash -- cryptographic hash functions
1
;    libcrash -- cryptographic hash functions
2
;
2
;
3
;    Copyright (C) 2012-2013 Ivan Baravy (dunkaist)
3
;    Copyright (C) 2012-2013,2016 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 13... Line 13...
13
;    GNU General Public License for more details.
13
;    GNU General Public License for more details.
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
MD4_BLOCK_SIZE = 64
-
 
20
MD4_HASH_SIZE  = 16
-
 
21
MD4_ALIGN      = 4
-
 
22
MD4_ALIGN_MASK = MD4_ALIGN - 1
-
 
23
 
-
 
24
struct ctx_md4
-
 
25
        hash            rb MD4_HASH_SIZE
-
 
26
        block           rb MD4_BLOCK_SIZE
-
 
27
        index           rd 1
-
 
28
        msglen_0        rd 1
-
 
29
        msglen_1        rd 1
-
 
30
ends
-
 
31
 
17
 
32
 
18
macro crash.md4.f b, c, d
33
macro md4._.f b, c, d
19
{
34
{
20
	push	c
35
        mov     eax, c
21
	xor	c, d
36
        xor     eax, d
22
	and	b, c
37
        and     eax, b
23
	xor	b, d
-
 
24
	pop	c
38
        xor     eax, d
Line 25... Line 39...
25
}
39
}
26
 
40
 
27
macro crash.md4.g b, c, d
41
macro md4._.g b, c, d
28
{
42
{
29
	push	c  d
43
        push    c d
30
	mov	edi, b
44
        mov     eax, b
31
	and	b, c
45
        and     eax, c
32
	and	c, d
46
        and     c, d
33
	and	d, edi
47
        and     d, b
34
	or	b, c
48
        or      eax, c
35
	or	b, d
49
        or      eax, d
Line 36... Line 50...
36
	pop	d  c
50
        pop     d c
37
}
51
}
-
 
52
 
38
 
53
macro md4._.h b, c, d
39
macro crash.md4.h b, c, d
54
{
40
{
55
        mov     eax, b
Line 41... Line 56...
41
	xor	b, c
56
        xor     eax, c
42
	xor	b, d
57
        xor     eax, d
43
}
-
 
44
 
58
}
45
macro crash.md4.round func, a, b, c, d, index, shift, ac
59
 
46
{
60
macro md4._.round func, a, b, c, d, index, shift, ac
47
	push	b
61
{
48
	func	b, c, d
-
 
49
	lea	a, [a + b + ac]
62
        func    b, c, d
Line 114... Line 237...
114
	mov	edi, [_md4]
237
        shl     eax, 3
115
	add	[edi + 0x0], eax
238
        mov     dword[edi], eax
Line -... Line 239...
-
 
239
        mov     dword[edi+4], edx
-
 
240
        lea     esi, [ebx + ctx_md4.block]
-
 
241
        lea     eax, [ebx + ctx_md4.hash]
-
 
242
        stdcall md4._.block, eax
-
 
243