Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3115 dunkaist 1
macro crash.md5.f b, c, d
2
{
3
	push	c
4
	xor	c, d
5
	and	b, c
6
	xor	b, d
7
	pop	c
8
}
9
 
10
macro crash.md5.g b, c, d
11
{
12
	push	c  d
13
	and	b, d
14
	not	d
15
	and	c, d
16
	or	b, c
17
	pop	d  c
18
}
19
 
20
macro crash.md5.h b, c, d
21
{
22
	xor	b, c
23
	xor	b, d
24
}
25
 
26
macro crash.md5.i b, c, d
27
{
28
	push	d
29
	not	d
30
	or	b, d
31
	xor	b, c
32
	pop	d
33
}
34
 
35
macro crash.md5.round func, a, b, c, d, index, shift, ac
36
{
37
	push	b
38
	func	b, c, d
39
	lea	a, [a + b + ac]
40
	add	a, [esi + index*4]
41
	rol	a, shift
42
	pop	b
43
	add	a, b
44
}
45
 
46
 
47
proc crash.md5 _md5, _data, _len, _callback, _msglen
48
locals
49
	final	rd 1
50
endl
51
	mov	[final], 0
52
  .first:
53
	mov	eax, [_msglen]
54
	mov	ecx, [_len]
55
	add	[eax], ecx
56
	mov	esi, [_data]
57
	test	ecx, ecx
58
	jz	.callback
59
  .begin:
60
	sub	[_len], 64
61
	jnc	@f
62
	add	[_len], 64
63
	jmp	.endofblock
64
    @@:
65
	mov	edi, [_md5]
66
	mov	eax, [edi + 0x0]
67
	mov	ebx, [edi + 0x4]
68
	mov	ecx, [edi + 0x8]
69
	mov	edx, [edi + 0xc]
70
 
71
	crash.md5.round		crash.md5.f, eax, ebx, ecx, edx,  0,  7, 0xd76aa478
72
	crash.md5.round		crash.md5.f, edx, eax, ebx, ecx,  1, 12, 0xe8c7b756
73
	crash.md5.round		crash.md5.f, ecx, edx, eax, ebx,  2, 17, 0x242070db
74
	crash.md5.round		crash.md5.f, ebx, ecx, edx, eax,  3, 22, 0xc1bdceee
75
	crash.md5.round		crash.md5.f, eax, ebx, ecx, edx,  4,  7, 0xf57c0faf
76
	crash.md5.round		crash.md5.f, edx, eax, ebx, ecx,  5, 12, 0x4787c62a
77
	crash.md5.round		crash.md5.f, ecx, edx, eax, ebx,  6, 17, 0xa8304613
78
	crash.md5.round		crash.md5.f, ebx, ecx, edx, eax,  7, 22, 0xfd469501
79
	crash.md5.round		crash.md5.f, eax, ebx, ecx, edx,  8,  7, 0x698098d8
80
	crash.md5.round		crash.md5.f, edx, eax, ebx, ecx,  9, 12, 0x8b44f7af
81
	crash.md5.round		crash.md5.f, ecx, edx, eax, ebx, 10, 17, 0xffff5bb1
82
	crash.md5.round		crash.md5.f, ebx, ecx, edx, eax, 11, 22, 0x895cd7be
83
	crash.md5.round		crash.md5.f, eax, ebx, ecx, edx, 12,  7, 0x6b901122
84
	crash.md5.round		crash.md5.f, edx, eax, ebx, ecx, 13, 12, 0xfd987193
85
	crash.md5.round		crash.md5.f, ecx, edx, eax, ebx, 14, 17, 0xa679438e
86
	crash.md5.round		crash.md5.f, ebx, ecx, edx, eax, 15, 22, 0x49b40821
87
 
88
	crash.md5.round		crash.md5.g, eax, ebx, ecx, edx,  1,  5, 0xf61e2562
89
	crash.md5.round		crash.md5.g, edx, eax, ebx, ecx,  6,  9, 0xc040b340
90
	crash.md5.round		crash.md5.g, ecx, edx, eax, ebx, 11, 14, 0x265e5a51
91
	crash.md5.round		crash.md5.g, ebx, ecx, edx, eax,  0, 20, 0xe9b6c7aa
92
	crash.md5.round		crash.md5.g, eax, ebx, ecx, edx,  5,  5, 0xd62f105d
93
	crash.md5.round		crash.md5.g, edx, eax, ebx, ecx, 10,  9, 0x02441453
94
	crash.md5.round		crash.md5.g, ecx, edx, eax, ebx, 15, 14, 0xd8a1e681
95
	crash.md5.round		crash.md5.g, ebx, ecx, edx, eax,  4, 20, 0xe7d3fbc8
96
	crash.md5.round		crash.md5.g, eax, ebx, ecx, edx,  9,  5, 0x21e1cde6
97
	crash.md5.round		crash.md5.g, edx, eax, ebx, ecx, 14,  9, 0xc33707d6
98
	crash.md5.round		crash.md5.g, ecx, edx, eax, ebx,  3, 14, 0xf4d50d87
99
	crash.md5.round		crash.md5.g, ebx, ecx, edx, eax,  8, 20, 0x455a14ed
100
	crash.md5.round		crash.md5.g, eax, ebx, ecx, edx, 13,  5, 0xa9e3e905
101
	crash.md5.round		crash.md5.g, edx, eax, ebx, ecx,  2,  9, 0xfcefa3f8
102
	crash.md5.round		crash.md5.g, ecx, edx, eax, ebx,  7, 14, 0x676f02d9
103
	crash.md5.round		crash.md5.g, ebx, ecx, edx, eax, 12, 20, 0x8d2a4c8a
104
 
105
	crash.md5.round		crash.md5.h, eax, ebx, ecx, edx,  5,  4, 0xfffa3942
106
	crash.md5.round		crash.md5.h, edx, eax, ebx, ecx,  8, 11, 0x8771f681
107
	crash.md5.round		crash.md5.h, ecx, edx, eax, ebx, 11, 16, 0x6d9d6122
108
	crash.md5.round		crash.md5.h, ebx, ecx, edx, eax, 14, 23, 0xfde5380c
109
	crash.md5.round		crash.md5.h, eax, ebx, ecx, edx,  1,  4, 0xa4beea44
110
	crash.md5.round		crash.md5.h, edx, eax, ebx, ecx,  4, 11, 0x4bdecfa9
111
	crash.md5.round		crash.md5.h, ecx, edx, eax, ebx,  7, 16, 0xf6bb4b60
112
	crash.md5.round		crash.md5.h, ebx, ecx, edx, eax, 10, 23, 0xbebfbc70
113
	crash.md5.round		crash.md5.h, eax, ebx, ecx, edx, 13,  4, 0x289b7ec6
114
	crash.md5.round		crash.md5.h, edx, eax, ebx, ecx,  0, 11, 0xeaa127fa
115
	crash.md5.round		crash.md5.h, ecx, edx, eax, ebx,  3, 16, 0xd4ef3085
116
	crash.md5.round		crash.md5.h, ebx, ecx, edx, eax,  6, 23, 0x04881d05
117
	crash.md5.round		crash.md5.h, eax, ebx, ecx, edx,  9,  4, 0xd9d4d039
118
	crash.md5.round		crash.md5.h, edx, eax, ebx, ecx, 12, 11, 0xe6db99e5
119
	crash.md5.round		crash.md5.h, ecx, edx, eax, ebx, 15, 16, 0x1fa27cf8
120
	crash.md5.round		crash.md5.h, ebx, ecx, edx, eax,  2, 23, 0xc4ac5665
121
 
122
	crash.md5.round		crash.md5.i, eax, ebx, ecx, edx,  0,  6, 0xf4292244
123
	crash.md5.round		crash.md5.i, edx, eax, ebx, ecx,  7, 10, 0x432aff97
124
	crash.md5.round		crash.md5.i, ecx, edx, eax, ebx, 14, 15, 0xab9423a7
125
	crash.md5.round		crash.md5.i, ebx, ecx, edx, eax,  5, 21, 0xfc93a039
126
	crash.md5.round		crash.md5.i, eax, ebx, ecx, edx, 12,  6, 0x655b59c3
127
	crash.md5.round		crash.md5.i, edx, eax, ebx, ecx,  3, 10, 0x8f0ccc92
128
	crash.md5.round		crash.md5.i, ecx, edx, eax, ebx, 10, 15, 0xffeff47d
129
	crash.md5.round		crash.md5.i, ebx, ecx, edx, eax,  1, 21, 0x85845dd1
130
	crash.md5.round		crash.md5.i, eax, ebx, ecx, edx,  8,  6, 0x6fa87e4f
131
	crash.md5.round		crash.md5.i, edx, eax, ebx, ecx, 15, 10, 0xfe2ce6e0
132
	crash.md5.round		crash.md5.i, ecx, edx, eax, ebx,  6, 15, 0xa3014314
133
	crash.md5.round		crash.md5.i, ebx, ecx, edx, eax, 13, 21, 0x4e0811a1
134
	crash.md5.round		crash.md5.i, eax, ebx, ecx, edx,  4,  6, 0xf7537e82
135
	crash.md5.round		crash.md5.i, edx, eax, ebx, ecx, 11, 10, 0xbd3af235
136
	crash.md5.round		crash.md5.i, ecx, edx, eax, ebx,  2, 15, 0x2ad7d2bb
137
	crash.md5.round		crash.md5.i, ebx, ecx, edx, eax,  9, 21, 0xeb86d391
138
 
139
	mov	edi, [_md5]
140
	add	[edi + 0x0], eax
141
	add	[edi + 0x4], ebx
142
	add	[edi + 0x8], ecx
143
	add	[edi + 0xc], edx
144
	add	esi, 64
145
	jmp	.begin
146
  .endofblock:
147
	cmp	[final], 1
148
	je	.quit
149
 
150
  .callback:
151
	mov	eax, [_callback]
152
	test	eax, eax
153
	jz	@f
154
	call	eax
155
	test	eax, eax
156
	jz	@f
157
	mov	[_len], eax
158
	jmp	.first
159
    @@:
160
 
161
	mov	edi, [_data]
162
	mov	ecx, [_len]
163
	rep	movsb
164
	mov	eax, [_msglen]
165
	mov	eax, [eax]
166
	and	eax, 63
167
	mov	ecx, 56
168
	sub	ecx, eax
169
	ja	@f
170
	add	ecx, 64
171
    @@:
172
	add	[_len], ecx
173
	mov	byte[edi], 0x80
174
	add	edi, 1
175
	sub	ecx, 1
176
	mov	al, 0
177
	rep	stosb
178
	mov	eax, [_msglen]
179
	mov	eax, [eax]
180
	mov	edx, 8
181
	mul	edx
182
	mov	dword[edi], eax
183
	mov	dword[edi + 4], edx
184
	add	[_len], 8
185
	mov	[final], 1
186
	jmp	.first
187
  .quit:
188
	ret
189
endp
190