86 void transform(
const uint1 block[blocksize]);
87 static void decode(uint4 output[],
const uint1
input[], size_type
len);
88 static void encode(uint1 output[],
const uint4
input[], size_type
len);
102 static inline void FF(
104 static inline void GG(
106 static inline void HH(
108 static inline void II(
135 return (
x &
y) | (~
x &
z);
140 return (
x &
z) | (
y & ~
z);
148 return (
x <<
n) | (
x >> (32 -
n));
156 a = rotate_left(
a + F(
b,
c, d) +
x + ac,
s) +
b;
162 a = rotate_left(
a + G(
b,
c, d) +
x + ac,
s) +
b;
168 a = rotate_left(
a + H(
b,
c, d) +
x + ac,
s) +
b;
174 a = rotate_left(
a + I(
b,
c, d) +
x + ac,
s) +
b;
187 update(text.c_str(), text.length());
201 state[0] = 0x67452301;
202 state[1] = 0xefcdab89;
203 state[2] = 0x98badcfe;
204 state[3] = 0x10325476;
213 for (
unsigned int i = 0, j = 0; j <
len; i++, j += 4)
227 output[j] =
input[i] & 0xff;
228 output[j + 1] = (
input[i] >> 8) & 0xff;
229 output[j + 2] = (
input[i] >> 16) & 0xff;
230 output[j + 3] = (
input[i] >> 24) & 0xff;
239 uint4 a = state[0],
b = state[1],
c = state[2], d = state[3],
x[16];
240 decode(
x, block, blocksize);
243 FF(
a,
b,
c, d,
x[0],
S11, 0xd76aa478);
244 FF(d,
a,
b,
c,
x[1],
S12, 0xe8c7b756);
245 FF(
c, d,
a,
b,
x[2],
S13, 0x242070db);
246 FF(
b,
c, d,
a,
x[3],
S14, 0xc1bdceee);
247 FF(
a,
b,
c, d,
x[4],
S11, 0xf57c0faf);
248 FF(d,
a,
b,
c,
x[5],
S12, 0x4787c62a);
249 FF(
c, d,
a,
b,
x[6],
S13, 0xa8304613);
250 FF(
b,
c, d,
a,
x[7],
S14, 0xfd469501);
251 FF(
a,
b,
c, d,
x[8],
S11, 0x698098d8);
252 FF(d,
a,
b,
c,
x[9],
S12, 0x8b44f7af);
253 FF(
c, d,
a,
b,
x[10],
S13, 0xffff5bb1);
254 FF(
b,
c, d,
a,
x[11],
S14, 0x895cd7be);
255 FF(
a,
b,
c, d,
x[12],
S11, 0x6b901122);
256 FF(d,
a,
b,
c,
x[13],
S12, 0xfd987193);
257 FF(
c, d,
a,
b,
x[14],
S13, 0xa679438e);
258 FF(
b,
c, d,
a,
x[15],
S14, 0x49b40821);
261 GG(
a,
b,
c, d,
x[1],
S21, 0xf61e2562);
262 GG(d,
a,
b,
c,
x[6],
S22, 0xc040b340);
263 GG(
c, d,
a,
b,
x[11],
S23, 0x265e5a51);
264 GG(
b,
c, d,
a,
x[0],
S24, 0xe9b6c7aa);
265 GG(
a,
b,
c, d,
x[5],
S21, 0xd62f105d);
266 GG(d,
a,
b,
c,
x[10],
S22, 0x2441453);
267 GG(
c, d,
a,
b,
x[15],
S23, 0xd8a1e681);
268 GG(
b,
c, d,
a,
x[4],
S24, 0xe7d3fbc8);
269 GG(
a,
b,
c, d,
x[9],
S21, 0x21e1cde6);
270 GG(d,
a,
b,
c,
x[14],
S22, 0xc33707d6);
271 GG(
c, d,
a,
b,
x[3],
S23, 0xf4d50d87);
272 GG(
b,
c, d,
a,
x[8],
S24, 0x455a14ed);
273 GG(
a,
b,
c, d,
x[13],
S21, 0xa9e3e905);
274 GG(d,
a,
b,
c,
x[2],
S22, 0xfcefa3f8);
275 GG(
c, d,
a,
b,
x[7],
S23, 0x676f02d9);
276 GG(
b,
c, d,
a,
x[12],
S24, 0x8d2a4c8a);
279 HH(
a,
b,
c, d,
x[5],
S31, 0xfffa3942);
280 HH(d,
a,
b,
c,
x[8],
S32, 0x8771f681);
281 HH(
c, d,
a,
b,
x[11],
S33, 0x6d9d6122);
282 HH(
b,
c, d,
a,
x[14],
S34, 0xfde5380c);
283 HH(
a,
b,
c, d,
x[1],
S31, 0xa4beea44);
284 HH(d,
a,
b,
c,
x[4],
S32, 0x4bdecfa9);
285 HH(
c, d,
a,
b,
x[7],
S33, 0xf6bb4b60);
286 HH(
b,
c, d,
a,
x[10],
S34, 0xbebfbc70);
287 HH(
a,
b,
c, d,
x[13],
S31, 0x289b7ec6);
288 HH(d,
a,
b,
c,
x[0],
S32, 0xeaa127fa);
289 HH(
c, d,
a,
b,
x[3],
S33, 0xd4ef3085);
290 HH(
b,
c, d,
a,
x[6],
S34, 0x4881d05);
291 HH(
a,
b,
c, d,
x[9],
S31, 0xd9d4d039);
292 HH(d,
a,
b,
c,
x[12],
S32, 0xe6db99e5);
293 HH(
c, d,
a,
b,
x[15],
S33, 0x1fa27cf8);
294 HH(
b,
c, d,
a,
x[2],
S34, 0xc4ac5665);
297 II(
a,
b,
c, d,
x[0],
S41, 0xf4292244);
298 II(d,
a,
b,
c,
x[7],
S42, 0x432aff97);
299 II(
c, d,
a,
b,
x[14],
S43, 0xab9423a7);
300 II(
b,
c, d,
a,
x[5],
S44, 0xfc93a039);
301 II(
a,
b,
c, d,
x[12],
S41, 0x655b59c3);
302 II(d,
a,
b,
c,
x[3],
S42, 0x8f0ccc92);
303 II(
c, d,
a,
b,
x[10],
S43, 0xffeff47d);
304 II(
b,
c, d,
a,
x[1],
S44, 0x85845dd1);
305 II(
a,
b,
c, d,
x[8],
S41, 0x6fa87e4f);
306 II(d,
a,
b,
c,
x[15],
S42, 0xfe2ce6e0);
307 II(
c, d,
a,
b,
x[6],
S43, 0xa3014314);
308 II(
b,
c, d,
a,
x[13],
S44, 0x4e0811a1);
309 II(
a,
b,
c, d,
x[4],
S41, 0xf7537e82);
310 II(d,
a,
b,
c,
x[11],
S42, 0xbd3af235);
311 II(
c, d,
a,
b,
x[2],
S43, 0x2ad7d2bb);
312 II(
b,
c, d,
a,
x[9],
S44, 0xeb86d391);
320 memset(
x, 0,
sizeof x);
337 size_type firstpart = 64 -
index;
349 for (i = firstpart; i + blocksize <=
length; i += blocksize)
375 static unsigned char padding[64] = {
376 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
378 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
383 unsigned char bits[8];
384 encode(bits,
count, 8);
389 update(padding, padLen);
395 encode(digest, state, 16);
412 if (!finalized)
return "";
415 for (
int i = 0; i < 16; i++)
sprintf(buf + i * 2,
"%02x", digest[i]);
425 return out <<
md5.hexdigest();
433 return md5.hexdigest();
443 return md5.hexdigest();
GLuint GLuint GLsizei count
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::string md5(const std::string &str)
Computes the md5 of a block of data.
void update(const unsigned char *buf, size_type length)
static void encode(uint1 output[], const uint4 input[], size_type len)
void transform(const uint1 block[blocksize])
static uint4 G(uint4 x, uint4 y, uint4 z)
static void FF(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
CStream & operator<<(mrpt::utils::CStream &s, const char *a)
GLsizei const GLchar ** string
static void II(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
static void decode(uint4 output[], const uint1 input[], size_type len)
static uint4 H(uint4 x, uint4 y, uint4 z)
std::string hexdigest() const
static uint4 rotate_left(uint4 x, int n)
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum input
static uint4 I(uint4 x, uint4 y, uint4 z)
static void HH(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
std::vector< uint8_t > vector_byte
GLuint GLenum GLenum transform
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLubyte GLubyte GLubyte a
static uint4 F(uint4 x, uint4 y, uint4 z)
int sprintf(char *buf, size_t bufSize, const char *format,...) noexcept MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
static void GG(uint4 &a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac)
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".