26static void encode(uint8_t
output[16],
const uint32_t input[4]);
29static void encode(uint8_t
output[8],
const uint64_t input);
32static const uint32_t*
decode(uint32_t storage[16],
const uint8_t input[64]);
36 this->state[0] = 0x67452301;
37 this->state[1] = 0xefcdab89;
38 this->state[2] = 0x98badcfe;
39 this->state[3] = 0x10325476;
43 const uint8_t* input =
reinterpret_cast<const uint8_t*
>(buf);
44 unsigned int bufferIndex = (
unsigned int)(this->byteCount & 0x3F);
45 unsigned int bufferAvailable = 64 - bufferIndex;
47 unsigned int inputIndex;
48 if (inputLength >= bufferAvailable) {
52 inputIndex = bufferAvailable;
57 for (; inputIndex + 63 < inputLength; inputIndex += 64) {
58 transform(this->state, &input[inputIndex]);
66 sk_careful_memcpy(&this->buffer[bufferIndex], &input[inputIndex], inputLength - inputIndex);
68 this->byteCount += inputLength;
79 unsigned int bufferIndex = (
unsigned int)(this->byteCount & 0x3F);
80 unsigned int paddingLength = (bufferIndex < 56) ? (56 - bufferIndex) : (120 - bufferIndex);
81 static const uint8_t PADDING[64] = {
82 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
84 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
85 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
87 (void)this->
write(PADDING, paddingLength);
90 (void)this->
write(bits, 8);
95#if defined(SK_MD5_CLEAR_DATA)
97 memset(
this, 0,
sizeof(*
this));
105 uint8_t
byte =
data[
i];
106 hexString[2 *
i + 0] = hexDigits[
byte >> 4];
107 hexString[2 *
i + 1] = hexDigits[
byte & 0xF];
122 return ((
y ^ z) &
x) ^ z;
126 return (
x & z) | (
y & (~z));
135 return y ^ (
x | (~z));
140 return (
x << n) | (
x >> (32 - n));
145 uint32_t
x, uint8_t
s, uint32_t t) {
149static void transform(uint32_t state[4],
const uint8_t block[64]) {
152 uint32_t storage[16];
153 const uint32_t*
X =
decode(storage, block);
232#if defined(SK_MD5_CLEAR_DATA)
235 memset(storage, 0,
sizeof(storage));
241 for (
size_t i = 0, j = 0;
i < 4;
i++, j += 4) {
242 output[j ] = (uint8_t) (input[
i] & 0xff);
243 output[j+1] = (uint8_t)((input[
i] >> 8) & 0xff);
244 output[j+2] = (uint8_t)((input[
i] >> 16) & 0xff);
245 output[j+3] = (uint8_t)((input[
i] >> 24) & 0xff);
250 output[0] = (uint8_t) (input & 0xff);
251 output[1] = (uint8_t)((input >> 8) & 0xff);
252 output[2] = (uint8_t)((input >> 16) & 0xff);
253 output[3] = (uint8_t)((input >> 24) & 0xff);
254 output[4] = (uint8_t)((input >> 32) & 0xff);
255 output[5] = (uint8_t)((input >> 40) & 0xff);
256 output[6] = (uint8_t)((input >> 48) & 0xff);
257 output[7] = (uint8_t)((input >> 56) & 0xff);
260static inline bool is_aligned(
const void *pointer,
size_t byte_count) {
261 return reinterpret_cast<uintptr_t
>(pointer) % byte_count == 0;
264static const uint32_t*
decode(uint32_t storage[16],
const uint8_t input[64]) {
265#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_FAST_UNALIGNED_ACCESS)
266 return reinterpret_cast<const uint32_t*
>(input);
268#if defined(SK_CPU_LENDIAN)
270 return reinterpret_cast<const uint32_t*
>(input);
273 for (
size_t i = 0, j = 0; j < 64;
i++, j += 4) {
274 storage[
i] = ((uint32_t)input[j ]) |
275 (((uint32_t)input[j+1]) << 8) |
276 (((uint32_t)input[j+2]) << 16) |
277 (((uint32_t)input[j+3]) << 24);
static uint32_t rotate_left(uint32_t x, uint8_t n)
static SkString to_hex_string(const uint8_t *data, const char *hexDigits)
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
static void encode(uint8_t output[16], const uint32_t input[4])
static void transform(uint32_t state[4], const uint8_t block[64])
static const uint32_t * decode(uint32_t storage[16], const uint8_t input[64])
static bool is_aligned(const void *pointer, size_t byte_count)
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
bool write(const void *buffer, size_t size) final
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
uint32_t operator()(uint32_t x, uint32_t y, uint32_t z)
uint32_t operator()(uint32_t x, uint32_t y, uint32_t z)
uint32_t operator()(uint32_t x, uint32_t y, uint32_t z)
uint32_t operator()(uint32_t x, uint32_t y, uint32_t z)
SkString toHexString() const
SkString toLowercaseHexString() const
std::shared_ptr< const fml::Mapping > data