MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / md5_process

Function md5_process

example/cacheCluster/md5.c:131–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130
131static void
132md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
133{
134 md5_word_t
135 a = pms->abcd[0], b = pms->abcd[1],
136 c = pms->abcd[2], d = pms->abcd[3];
137 md5_word_t t;
138#if BYTE_ORDER > 0
139 /* Define storage only for big-endian CPUs. */
140 md5_word_t X[16];
141#else
142 /* Define storage for little-endian or both types of CPUs. */
143 md5_word_t xbuf[16];
144 const md5_word_t *X;
145#endif
146
147 {
148#if BYTE_ORDER == 0
149 /*
150 * Determine dynamically whether this is a big-endian or
151 * little-endian machine, since we can use a more efficient
152 * algorithm on the latter.
153 */
154 static const int w = 1;
155
156 if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
157#endif
158#if BYTE_ORDER <= 0 /* little-endian */
159 {
160 /*
161 * On little-endian machines, we can process properly aligned
162 * data without copying it.
163 */
164 if (!((data - (const md5_byte_t *)0) & 3)) {
165 /* data are properly aligned */
166 X = (const md5_word_t *)data;
167 } else {
168 /* not aligned */
169 memcpy(xbuf, data, 64);
170 X = xbuf;
171 }
172 }
173#endif
174#if BYTE_ORDER == 0
175 else /* dynamic big-endian */
176#endif
177#if BYTE_ORDER >= 0 /* big-endian */
178 {
179 /*
180 * On big-endian machines, we must arrange the bytes in the
181 * right order.
182 */
183 const md5_byte_t *xp = data;
184 int i;
185
186# if BYTE_ORDER == 0
187 X = xbuf; /* (dynamic only) */
188# else

Callers 1

md5_appendFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected