OLD | NEW |
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 | 7 |
8 #ifndef SkMD5_DEFINED | 8 #ifndef SkMD5_DEFINED |
9 #define SkMD5_DEFINED | 9 #define SkMD5_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "SkEndian.h" | 12 #include "SkEndian.h" |
13 #include "SkStream.h" | 13 #include "SkStream.h" |
14 | 14 |
15 //The following macros can be defined to affect the MD5 code generated. | 15 //The following macros can be defined to affect the MD5 code generated. |
16 //SK_MD5_CLEAR_DATA causes all intermediate state to be overwritten with 0's. | 16 //SK_MD5_CLEAR_DATA causes all intermediate state to be overwritten with 0's. |
17 //SK_CPU_LENDIAN allows 32 bit <=> 8 bit conversions without copies (if alligned
). | 17 //SK_CPU_LENDIAN allows 32 bit <=> 8 bit conversions without copies (if alligned
). |
18 //SK_CPU_FAST_UNALIGNED_ACCESS allows 32 bit <=> 8 bit conversions without copie
s if SK_CPU_LENDIAN. | 18 //SK_CPU_FAST_UNALIGNED_ACCESS allows 32 bit <=> 8 bit conversions without copie
s if SK_CPU_LENDIAN. |
19 | 19 |
20 class SkMD5 : SkWStream { | 20 class SkMD5 : public SkWStream { |
21 public: | 21 public: |
22 SkMD5(); | 22 SkMD5(); |
23 | 23 |
24 /** Processes input, adding it to the digest. | 24 /** Processes input, adding it to the digest. |
25 * Note that this treats the buffer as a series of uint8_t values. | 25 * Note that this treats the buffer as a series of uint8_t values. |
26 */ | 26 */ |
27 virtual bool write(const void* buffer, size_t size) SK_OVERRIDE { | 27 virtual bool write(const void* buffer, size_t size) SK_OVERRIDE { |
28 update(reinterpret_cast<const uint8_t*>(buffer), size); | 28 update(reinterpret_cast<const uint8_t*>(buffer), size); |
29 return true; | 29 return true; |
30 } | 30 } |
(...skipping 13 matching lines...) Expand all Loading... |
44 uint64_t byteCount; | 44 uint64_t byteCount; |
45 | 45 |
46 // state (ABCD) | 46 // state (ABCD) |
47 uint32_t state[4]; | 47 uint32_t state[4]; |
48 | 48 |
49 // input buffer | 49 // input buffer |
50 uint8_t buffer[64]; | 50 uint8_t buffer[64]; |
51 }; | 51 }; |
52 | 52 |
53 #endif | 53 #endif |
OLD | NEW |