s_ByteReverse(
unsigned char*
buf,
size_tlongs)
47 t= (
Uint4) ((
unsigned)
buf[3] << 8 |
buf[2]) << 16 |
48((
unsigned)
buf[1] << 8 |
buf[0]);
49*(
reinterpret_cast<Uint4*
>(
buf)) =
t;
59: m_Bits(0), m_Finalized(
false)
61 m_Buf[0] = 0x67452301;
62 m_Buf[1] = 0xefcdab89;
63 m_Buf[2] = 0x98badcfe;
64 m_Buf[3] = 0x10325476;
73 "attempt to update a finalized MD5 instance");
84 unsigned char* p =
m_In+
tmp;
88memcpy(p,
buf, length);
92 #ifdef WORDS_BIGENDIAN 93s_ByteReverse(
m_In, 16);
103 #ifdef WORDS_BIGENDIAN 104s_ByteReverse(
m_In, 16);
121memcpy(digest,
m_Buf, 16);
139memset(p, 0,
count);
140 #ifdef WORDS_BIGENDIAN 141s_ByteReverse(
m_In, 16);
149memset(p, 0,
count- 8);
150 #ifdef WORDS_BIGENDIAN 151s_ByteReverse(
m_In, 14);
158memcpy(
m_In+ 14*
sizeof(bits), &bits,
sizeof(bits));
160memcpy(
m_In+ 15*
sizeof(bits), &bits,
sizeof(bits));
163 #ifdef WORDS_BIGENDIAN 164s_ByteReverse(
reinterpret_cast<unsigned char*
>(
m_Buf), 4);
166memcpy(digest,
m_Buf, 16);
175oss <<
hex<< setfill(
'0');
176 for(
size_t i= 0;
i< 16; ++
i) {
177oss << setw(2) << (
int)digest[
i];
186 #define F1(x, y, z) (z ^ (x & (y ^ z))) 187 #define F2(x, y, z) ((z & x) | (~z & y)) 188 #define F3(x, y, z) (x ^ (y ^ z)) 189 #define F4(x, y, z) (y ^ (x | ~z)) 192 #define MD5STEP(f, w, x, y, z, data, s) \ 193 ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) 208 MD5STEP(
F1,
a,
b, c, d, inw[0] + 0xd76aa478, 7);
209 MD5STEP(
F1, d,
a,
b, c, inw[1] + 0xe8c7b756, 12);
210 MD5STEP(
F1, c, d,
a,
b, inw[2] + 0x242070db, 17);
211 MD5STEP(
F1,
b, c, d,
a, inw[3] + 0xc1bdceee, 22);
212 MD5STEP(
F1,
a,
b, c, d, inw[4] + 0xf57c0faf, 7);
213 MD5STEP(
F1, d,
a,
b, c, inw[5] + 0x4787c62a, 12);
214 MD5STEP(
F1, c, d,
a,
b, inw[6] + 0xa8304613, 17);
215 MD5STEP(
F1,
b, c, d,
a, inw[7] + 0xfd469501, 22);
216 MD5STEP(
F1,
a,
b, c, d, inw[8] + 0x698098d8, 7);
217 MD5STEP(
F1, d,
a,
b, c, inw[9] + 0x8b44f7af, 12);
218 MD5STEP(
F1, c, d,
a,
b, inw[10] + 0xffff5bb1, 17);
219 MD5STEP(
F1,
b, c, d,
a, inw[11] + 0x895cd7be, 22);
220 MD5STEP(
F1,
a,
b, c, d, inw[12] + 0x6b901122, 7);
221 MD5STEP(
F1, d,
a,
b, c, inw[13] + 0xfd987193, 12);
222 MD5STEP(
F1, c, d,
a,
b, inw[14] + 0xa679438e, 17);
223 MD5STEP(
F1,
b, c, d,
a, inw[15] + 0x49b40821, 22);
225 MD5STEP(
F2,
a,
b, c, d, inw[1] + 0xf61e2562, 5);
226 MD5STEP(
F2, d,
a,
b, c, inw[6] + 0xc040b340, 9);
227 MD5STEP(
F2, c, d,
a,
b, inw[11] + 0x265e5a51, 14);
228 MD5STEP(
F2,
b, c, d,
a, inw[0] + 0xe9b6c7aa, 20);
229 MD5STEP(
F2,
a,
b, c, d, inw[5] + 0xd62f105d, 5);
230 MD5STEP(
F2, d,
a,
b, c, inw[10] + 0x02441453, 9);
231 MD5STEP(
F2, c, d,
a,
b, inw[15] + 0xd8a1e681, 14);
232 MD5STEP(
F2,
b, c, d,
a, inw[4] + 0xe7d3fbc8, 20);
233 MD5STEP(
F2,
a,
b, c, d, inw[9] + 0x21e1cde6, 5);
234 MD5STEP(
F2, d,
a,
b, c, inw[14] + 0xc33707d6, 9);
235 MD5STEP(
F2, c, d,
a,
b, inw[3] + 0xf4d50d87, 14);
236 MD5STEP(
F2,
b, c, d,
a, inw[8] + 0x455a14ed, 20);
237 MD5STEP(
F2,
a,
b, c, d, inw[13] + 0xa9e3e905, 5);
238 MD5STEP(
F2, d,
a,
b, c, inw[2] + 0xfcefa3f8, 9);
239 MD5STEP(
F2, c, d,
a,
b, inw[7] + 0x676f02d9, 14);
240 MD5STEP(
F2,
b, c, d,
a, inw[12] + 0x8d2a4c8a, 20);
242 MD5STEP(
F3,
a,
b, c, d, inw[5] + 0xfffa3942, 4);
243 MD5STEP(
F3, d,
a,
b, c, inw[8] + 0x8771f681, 11);
244 MD5STEP(
F3, c, d,
a,
b, inw[11] + 0x6d9d6122, 16);
245 MD5STEP(
F3,
b, c, d,
a, inw[14] + 0xfde5380c, 23);
246 MD5STEP(
F3,
a,
b, c, d, inw[1] + 0xa4beea44, 4);
247 MD5STEP(
F3, d,
a,
b, c, inw[4] + 0x4bdecfa9, 11);
248 MD5STEP(
F3, c, d,
a,
b, inw[7] + 0xf6bb4b60, 16);
249 MD5STEP(
F3,
b, c, d,
a, inw[10] + 0xbebfbc70, 23);
250 MD5STEP(
F3,
a,
b, c, d, inw[13] + 0x289b7ec6, 4);
251 MD5STEP(
F3, d,
a,
b, c, inw[0] + 0xeaa127fa, 11);
252 MD5STEP(
F3, c, d,
a,
b, inw[3] + 0xd4ef3085, 16);
253 MD5STEP(
F3,
b, c, d,
a, inw[6] + 0x04881d05, 23);
254 MD5STEP(
F3,
a,
b, c, d, inw[9] + 0xd9d4d039, 4);
255 MD5STEP(
F3, d,
a,
b, c, inw[12] + 0xe6db99e5, 11);
256 MD5STEP(
F3, c, d,
a,
b, inw[15] + 0x1fa27cf8, 16);
257 MD5STEP(
F3,
b, c, d,
a, inw[2] + 0xc4ac5665, 23);
259 MD5STEP(
F4,
a,
b, c, d, inw[0] + 0xf4292244, 6);
260 MD5STEP(
F4, d,
a,
b, c, inw[7] + 0x432aff97, 10);
261 MD5STEP(
F4, c, d,
a,
b, inw[14] + 0xab9423a7, 15);
262 MD5STEP(
F4,
b, c, d,
a, inw[5] + 0xfc93a039, 21);
263 MD5STEP(
F4,
a,
b, c, d, inw[12] + 0x655b59c3, 6);
264 MD5STEP(
F4, d,
a,
b, c, inw[3] + 0x8f0ccc92, 10);
265 MD5STEP(
F4, c, d,
a,
b, inw[10] + 0xffeff47d, 15);
266 MD5STEP(
F4,
b, c, d,
a, inw[1] + 0x85845dd1, 21);
267 MD5STEP(
F4,
a,
b, c, d, inw[8] + 0x6fa87e4f, 6);
268 MD5STEP(
F4, d,
a,
b, c, inw[15] + 0xfe2ce6e0, 10);
269 MD5STEP(
F4, c, d,
a,
b, inw[6] + 0xa3014314, 15);
270 MD5STEP(
F4,
b, c, d,
a, inw[13] + 0x4e0811a1, 21);
271 MD5STEP(
F4,
a,
b, c, d, inw[4] + 0xf7537e82, 6);
272 MD5STEP(
F4, d,
a,
b, c, inw[11] + 0xbd3af235, 10);
273 MD5STEP(
F4, c, d,
a,
b, inw[2] + 0x2ad7d2bb, 15);
274 MD5STEP(
F4,
b, c, d,
a, inw[9] + 0xeb86d391, 21);
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
void Update(const char *buf, size_t length)
unsigned char m_In[kBlockSize]
void Finalize(unsigned char digest[16])
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
#define MD5STEP(f, w, x, y, z, data, s)
CMD5 - class for computing Message Digest version 5 checksums.
static void hex(unsigned char c)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4