Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/core/SkMD5.cpp

Issue 1913173003: SkMD5: .update() -> .write() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-22 (Friday) 16:17:21 EDT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkMD5.h ('k') | tests/CodecTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 * 6 *
7 * The following code is based on the description in RFC 1321. 7 * The following code is based on the description in RFC 1321.
8 * http://www.ietf.org/rfc/rfc1321.txt 8 * http://www.ietf.org/rfc/rfc1321.txt
9 */ 9 */
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // Pad out to 56 mod 64. 74 // Pad out to 56 mod 64.
75 unsigned int bufferIndex = (unsigned int)(this->byteCount & 0x3F); 75 unsigned int bufferIndex = (unsigned int)(this->byteCount & 0x3F);
76 unsigned int paddingLength = (bufferIndex < 56) ? (56 - bufferIndex) : (120 - bufferIndex); 76 unsigned int paddingLength = (bufferIndex < 56) ? (56 - bufferIndex) : (120 - bufferIndex);
77 static uint8_t PADDING[64] = { 77 static uint8_t PADDING[64] = {
78 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
79 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
80 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
82 }; 82 };
83 this->update(PADDING, paddingLength); 83 (void)this->write(PADDING, paddingLength);
84 84
85 // Append length (length before padding, will cause final update). 85 // Append length (length before padding, will cause final update).
86 this->update(bits, 8); 86 (void)this->write(bits, 8);
tomhudson 2016/04/22 20:49:55 Having to cast void return. :(
87 87
88 // Write out digest. 88 // Write out digest.
89 encode(digest.data, this->state); 89 encode(digest.data, this->state);
90 90
91 #if defined(SK_MD5_CLEAR_DATA) 91 #if defined(SK_MD5_CLEAR_DATA)
92 // Clear state. 92 // Clear state.
93 memset(this, 0, sizeof(*this)); 93 memset(this, 0, sizeof(*this));
94 #endif 94 #endif
95 } 95 }
96 96
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 #endif 249 #endif
250 for (size_t i = 0, j = 0; j < 64; i++, j += 4) { 250 for (size_t i = 0, j = 0; j < 64; i++, j += 4) {
251 storage[i] = ((uint32_t)input[j ]) | 251 storage[i] = ((uint32_t)input[j ]) |
252 (((uint32_t)input[j+1]) << 8) | 252 (((uint32_t)input[j+1]) << 8) |
253 (((uint32_t)input[j+2]) << 16) | 253 (((uint32_t)input[j+2]) << 16) |
254 (((uint32_t)input[j+3]) << 24); 254 (((uint32_t)input[j+3]) << 24);
255 } 255 }
256 return storage; 256 return storage;
257 #endif 257 #endif
258 } 258 }
OLDNEW
« no previous file with comments | « src/core/SkMD5.h ('k') | tests/CodecTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698