1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Code generated by go run gen.go -full -output md5block.go; DO NOT EDIT.
14 const x86
= runtime
.GOARCH
== "amd64" || runtime
.GOARCH
== "386"
19 x
:= uint32(0x04030201)
20 y
:= [4]byte{0x1, 0x2, 0x3, 0x4}
21 littleEndian
= *(*[4]byte)(unsafe
.Pointer(&x
)) == y
24 func blockGeneric(dig
*digest
, p
[]byte) {
32 aa
, bb
, cc
, dd
:= a
, b
, c
, d
34 // This is a constant condition - it is not evaluated on each iteration.
36 // MD5 was designed so that x86 processors can just iterate
37 // over the block data directly as uint32s, and we generate
38 // less code and run 1.3x faster if we take advantage of that.
40 X
= (*[16]uint32)(unsafe
.Pointer(&p
[0]))
41 } else if littleEndian
&& uintptr(unsafe
.Pointer(&p
[0]))&(unsafe
.Alignof(uint32(0))-1) == 0 {
42 X
= (*[16]uint32)(unsafe
.Pointer(&p
[0]))
46 for i
:= 0; i
< 16; i
++ {
47 X
[i
&15] = uint32(p
[j
]) |
uint32(p
[j
+1])<<8 |
uint32(p
[j
+2])<<16 |
uint32(p
[j
+3])<<24
54 a
+= (((c
^ d
) & b
) ^ d
) + X
[0] + 3614090360
55 a
= a
<<7 | a
>>(32-7) + b
57 d
+= (((b
^ c
) & a
) ^ c
) + X
[1] + 3905402710
58 d
= d
<<12 | d
>>(32-12) + a
60 c
+= (((a
^ b
) & d
) ^ b
) + X
[2] + 606105819
61 c
= c
<<17 | c
>>(32-17) + d
63 b
+= (((d
^ a
) & c
) ^ a
) + X
[3] + 3250441966
64 b
= b
<<22 | b
>>(32-22) + c
66 a
+= (((c
^ d
) & b
) ^ d
) + X
[4] + 4118548399
67 a
= a
<<7 | a
>>(32-7) + b
69 d
+= (((b
^ c
) & a
) ^ c
) + X
[5] + 1200080426
70 d
= d
<<12 | d
>>(32-12) + a
72 c
+= (((a
^ b
) & d
) ^ b
) + X
[6] + 2821735955
73 c
= c
<<17 | c
>>(32-17) + d
75 b
+= (((d
^ a
) & c
) ^ a
) + X
[7] + 4249261313
76 b
= b
<<22 | b
>>(32-22) + c
78 a
+= (((c
^ d
) & b
) ^ d
) + X
[8] + 1770035416
79 a
= a
<<7 | a
>>(32-7) + b
81 d
+= (((b
^ c
) & a
) ^ c
) + X
[9] + 2336552879
82 d
= d
<<12 | d
>>(32-12) + a
84 c
+= (((a
^ b
) & d
) ^ b
) + X
[10] + 4294925233
85 c
= c
<<17 | c
>>(32-17) + d
87 b
+= (((d
^ a
) & c
) ^ a
) + X
[11] + 2304563134
88 b
= b
<<22 | b
>>(32-22) + c
90 a
+= (((c
^ d
) & b
) ^ d
) + X
[12] + 1804603682
91 a
= a
<<7 | a
>>(32-7) + b
93 d
+= (((b
^ c
) & a
) ^ c
) + X
[13] + 4254626195
94 d
= d
<<12 | d
>>(32-12) + a
96 c
+= (((a
^ b
) & d
) ^ b
) + X
[14] + 2792965006
97 c
= c
<<17 | c
>>(32-17) + d
99 b
+= (((d
^ a
) & c
) ^ a
) + X
[15] + 1236535329
100 b
= b
<<22 | b
>>(32-22) + c
104 a
+= (((b
^ c
) & d
) ^ c
) + X
[(1+5*0)&15] + 4129170786
105 a
= a
<<5 | a
>>(32-5) + b
107 d
+= (((a
^ b
) & c
) ^ b
) + X
[(1+5*1)&15] + 3225465664
108 d
= d
<<9 | d
>>(32-9) + a
110 c
+= (((d
^ a
) & b
) ^ a
) + X
[(1+5*2)&15] + 643717713
111 c
= c
<<14 | c
>>(32-14) + d
113 b
+= (((c
^ d
) & a
) ^ d
) + X
[(1+5*3)&15] + 3921069994
114 b
= b
<<20 | b
>>(32-20) + c
116 a
+= (((b
^ c
) & d
) ^ c
) + X
[(1+5*4)&15] + 3593408605
117 a
= a
<<5 | a
>>(32-5) + b
119 d
+= (((a
^ b
) & c
) ^ b
) + X
[(1+5*5)&15] + 38016083
120 d
= d
<<9 | d
>>(32-9) + a
122 c
+= (((d
^ a
) & b
) ^ a
) + X
[(1+5*6)&15] + 3634488961
123 c
= c
<<14 | c
>>(32-14) + d
125 b
+= (((c
^ d
) & a
) ^ d
) + X
[(1+5*7)&15] + 3889429448
126 b
= b
<<20 | b
>>(32-20) + c
128 a
+= (((b
^ c
) & d
) ^ c
) + X
[(1+5*8)&15] + 568446438
129 a
= a
<<5 | a
>>(32-5) + b
131 d
+= (((a
^ b
) & c
) ^ b
) + X
[(1+5*9)&15] + 3275163606
132 d
= d
<<9 | d
>>(32-9) + a
134 c
+= (((d
^ a
) & b
) ^ a
) + X
[(1+5*10)&15] + 4107603335
135 c
= c
<<14 | c
>>(32-14) + d
137 b
+= (((c
^ d
) & a
) ^ d
) + X
[(1+5*11)&15] + 1163531501
138 b
= b
<<20 | b
>>(32-20) + c
140 a
+= (((b
^ c
) & d
) ^ c
) + X
[(1+5*12)&15] + 2850285829
141 a
= a
<<5 | a
>>(32-5) + b
143 d
+= (((a
^ b
) & c
) ^ b
) + X
[(1+5*13)&15] + 4243563512
144 d
= d
<<9 | d
>>(32-9) + a
146 c
+= (((d
^ a
) & b
) ^ a
) + X
[(1+5*14)&15] + 1735328473
147 c
= c
<<14 | c
>>(32-14) + d
149 b
+= (((c
^ d
) & a
) ^ d
) + X
[(1+5*15)&15] + 2368359562
150 b
= b
<<20 | b
>>(32-20) + c
154 a
+= (b
^ c
^ d
) + X
[(5+3*0)&15] + 4294588738
155 a
= a
<<4 | a
>>(32-4) + b
157 d
+= (a
^ b
^ c
) + X
[(5+3*1)&15] + 2272392833
158 d
= d
<<11 | d
>>(32-11) + a
160 c
+= (d
^ a
^ b
) + X
[(5+3*2)&15] + 1839030562
161 c
= c
<<16 | c
>>(32-16) + d
163 b
+= (c
^ d
^ a
) + X
[(5+3*3)&15] + 4259657740
164 b
= b
<<23 | b
>>(32-23) + c
166 a
+= (b
^ c
^ d
) + X
[(5+3*4)&15] + 2763975236
167 a
= a
<<4 | a
>>(32-4) + b
169 d
+= (a
^ b
^ c
) + X
[(5+3*5)&15] + 1272893353
170 d
= d
<<11 | d
>>(32-11) + a
172 c
+= (d
^ a
^ b
) + X
[(5+3*6)&15] + 4139469664
173 c
= c
<<16 | c
>>(32-16) + d
175 b
+= (c
^ d
^ a
) + X
[(5+3*7)&15] + 3200236656
176 b
= b
<<23 | b
>>(32-23) + c
178 a
+= (b
^ c
^ d
) + X
[(5+3*8)&15] + 681279174
179 a
= a
<<4 | a
>>(32-4) + b
181 d
+= (a
^ b
^ c
) + X
[(5+3*9)&15] + 3936430074
182 d
= d
<<11 | d
>>(32-11) + a
184 c
+= (d
^ a
^ b
) + X
[(5+3*10)&15] + 3572445317
185 c
= c
<<16 | c
>>(32-16) + d
187 b
+= (c
^ d
^ a
) + X
[(5+3*11)&15] + 76029189
188 b
= b
<<23 | b
>>(32-23) + c
190 a
+= (b
^ c
^ d
) + X
[(5+3*12)&15] + 3654602809
191 a
= a
<<4 | a
>>(32-4) + b
193 d
+= (a
^ b
^ c
) + X
[(5+3*13)&15] + 3873151461
194 d
= d
<<11 | d
>>(32-11) + a
196 c
+= (d
^ a
^ b
) + X
[(5+3*14)&15] + 530742520
197 c
= c
<<16 | c
>>(32-16) + d
199 b
+= (c
^ d
^ a
) + X
[(5+3*15)&15] + 3299628645
200 b
= b
<<23 | b
>>(32-23) + c
204 a
+= (c
^ (b |
^d
)) + X
[(7*0)&15] + 4096336452
205 a
= a
<<6 | a
>>(32-6) + b
207 d
+= (b
^ (a |
^c
)) + X
[(7*1)&15] + 1126891415
208 d
= d
<<10 | d
>>(32-10) + a
210 c
+= (a
^ (d |
^b
)) + X
[(7*2)&15] + 2878612391
211 c
= c
<<15 | c
>>(32-15) + d
213 b
+= (d
^ (c |
^a
)) + X
[(7*3)&15] + 4237533241
214 b
= b
<<21 | b
>>(32-21) + c
216 a
+= (c
^ (b |
^d
)) + X
[(7*4)&15] + 1700485571
217 a
= a
<<6 | a
>>(32-6) + b
219 d
+= (b
^ (a |
^c
)) + X
[(7*5)&15] + 2399980690
220 d
= d
<<10 | d
>>(32-10) + a
222 c
+= (a
^ (d |
^b
)) + X
[(7*6)&15] + 4293915773
223 c
= c
<<15 | c
>>(32-15) + d
225 b
+= (d
^ (c |
^a
)) + X
[(7*7)&15] + 2240044497
226 b
= b
<<21 | b
>>(32-21) + c
228 a
+= (c
^ (b |
^d
)) + X
[(7*8)&15] + 1873313359
229 a
= a
<<6 | a
>>(32-6) + b
231 d
+= (b
^ (a |
^c
)) + X
[(7*9)&15] + 4264355552
232 d
= d
<<10 | d
>>(32-10) + a
234 c
+= (a
^ (d |
^b
)) + X
[(7*10)&15] + 2734768916
235 c
= c
<<15 | c
>>(32-15) + d
237 b
+= (d
^ (c |
^a
)) + X
[(7*11)&15] + 1309151649
238 b
= b
<<21 | b
>>(32-21) + c
240 a
+= (c
^ (b |
^d
)) + X
[(7*12)&15] + 4149444226
241 a
= a
<<6 | a
>>(32-6) + b
243 d
+= (b
^ (a |
^c
)) + X
[(7*13)&15] + 3174756917
244 d
= d
<<10 | d
>>(32-10) + a
246 c
+= (a
^ (d |
^b
)) + X
[(7*14)&15] + 718787259
247 c
= c
<<15 | c
>>(32-15) + d
249 b
+= (d
^ (c |
^a
)) + X
[(7*15)&15] + 3951481745
250 b
= b
<<21 | b
>>(32-21) + c