55#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
56#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
57#define H(x, y, z) ((x) ^ (y) ^ (z))
58#define I(x, y, z) ((y) ^ ((x) | ~(z)))
61#define STEP(f, a, b, c, d, x, t, s) \
62 (a) += f((b), (c), (d)) + (x) + (t); \
63 (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
69 (InternalState.block[(n)] = (MD5_u32plus)ptr[(n)*4] | \
70 ((MD5_u32plus)ptr[(n)*4 + 1] << 8) | \
71 ((MD5_u32plus)ptr[(n)*4 + 2] << 16) | \
72 ((MD5_u32plus)ptr[(n)*4 + 3] << 24))
73#define GET(n) (InternalState.block[(n)])
81 MD5_u32plus
a,
b,
c,
d;
82 MD5_u32plus saved_a, saved_b, saved_c, saved_d;
176 }
while (
Size -= 64);
191 unsigned long used, free;
192 const uint8_t *
Ptr =
Data.data();
195 saved_lo = InternalState.lo;
196 if ((InternalState.lo = (saved_lo +
Size) & 0x1fffffff) < saved_lo)
198 InternalState.hi +=
Size >> 29;
200 used = saved_lo & 0x3f;
206 memcpy(&InternalState.buffer[used],
Ptr,
Size);
210 memcpy(&InternalState.buffer[used],
Ptr, free);
213 body(
ArrayRef(InternalState.buffer, 64));
221 memcpy(InternalState.buffer,
Ptr,
Size);
235 unsigned long used, free;
237 used = InternalState.lo & 0x3f;
239 InternalState.buffer[used++] = 0x80;
244 memset(&InternalState.buffer[used], 0, free);
245 body(
ArrayRef(InternalState.buffer, 64));
250 memset(&InternalState.buffer[used], 0, free - 8);
252 InternalState.lo <<= 3;
256 body(
ArrayRef(InternalState.buffer, 64));
271 auto StateToRestore = InternalState;
276 InternalState = StateToRestore;
283 toHex(*
this,
true, Str);
288 toHex(Result,
true, Str);
#define STEP(f, a, b, c, d, x, t, s)
#define SET(ID, TYPE, VAL)
This file defines the SmallString class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
static void stringifyResult(MD5Result &Result, SmallVectorImpl< char > &Str)
Translates the bytes in Res to a hex string that is deposited into Str.
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
MD5Result final()
Finishes off the hash, and returns the 16-byte hash data.
MD5Result result()
Finishes off the hash, and returns the 16-byte hash data.
static MD5Result hash(ArrayRef< uint8_t > Data)
Computes the hash for a given bytes.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
void write32le(void *P, uint32_t V)
This is an optimization pass for GlobalISel generic memory operations.
SmallString< 32 > digest() const