@@ -71,16 +71,18 @@ loop:
71
71
MOVL DX, R9
72
72
MOVL DX, R10
73
73
74
+ // Uses https://github.com/animetosho/md5-optimisation#dependency-shortcut-in-g-function
75
+
74
76
#define ROUND2(a, b, c, d, index, const, shift) \
75
77
XORL R11, R9; \
76
78
ADDL $const, a; \
77
79
ADDL R8, a; \
78
80
ANDL b, R10; \
79
81
ANDL c, R9; \
80
82
MOVL (index*4 )(SI),R8; \
81
- ORL R9, R10; \
83
+ ADDL R9, a; \
84
+ ADDL R10, a; \
82
85
MOVL c, R9; \
83
- ADDL R10, a; \
84
86
MOVL c, R10; \
85
87
ROLL $shift, a; \
86
88
ADDL b, a
@@ -104,18 +106,30 @@ loop:
104
106
105
107
MOVL CX, R9
106
108
107
- #define ROUND3(a, b, c, d, index, const, shift) \
109
+ // Uses https://github.com/animetosho/md5-optimisation#h-function-re-use
110
+
111
+ #define ROUND3FIRST(a, b, c, d, index, const, shift) \
112
+ MOVL d, R9; \
113
+ XORL c, R9; \
114
+ XORL b, R9; \
108
115
ADDL $const, a; \
109
116
ADDL R8, a; \
110
117
MOVL (index*4 )(SI),R8; \
111
- XORL d, R9; \
118
+ ADDL R9, a; \
119
+ ROLL $shift, a; \
120
+ ADDL b, a
121
+
122
+ #define ROUND3(a, b, c, d, index, const, shift) \
123
+ XORL a, R9; \
112
124
XORL b, R9; \
125
+ ADDL $const, a; \
126
+ ADDL R8, a; \
127
+ MOVL (index*4 )(SI),R8; \
113
128
ADDL R9, a; \
114
129
ROLL $shift, a; \
115
- MOVL b, R9; \
116
130
ADDL b, a
117
131
118
- ROUND3 (AX,BX,CX,DX, 8 ,0xfffa3942 , 4 );
132
+ ROUND3FIRST (AX,BX,CX,DX, 8 ,0xfffa3942 , 4 );
119
133
ROUND3(DX,AX,BX,CX,11 ,0x8771f681 ,11 );
120
134
ROUND3(CX,DX,AX,BX,14 ,0x6d9d6122 ,16 );
121
135
ROUND3(BX,CX,DX,AX, 1 ,0xfde5380c ,23 );
0 commit comments