| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(jww) The original Blink-style header guard for this file conflicts with | 5 // TODO(jww) The original Blink-style header guard for this file conflicts with |
| 6 // the header guard in Source/modules/crypto/Crypto.h, so this is a | 6 // the header guard in Source/modules/crypto/Crypto.h, so this is a |
| 7 // Chromium-style header guard instead. There is now a bug | 7 // Chromium-style header guard instead. There is now a bug |
| 8 // (https://crbug.com/360121) to track a proposal to change all header guards | 8 // (https://crbug.com/360121) to track a proposal to change all header guards |
| 9 // to a similar style. Thus, whenever that is resolved, this header guard | 9 // to a similar style. Thus, whenever that is resolved, this header guard |
| 10 // should be changed to whatever style is agreed upon. | 10 // should be changed to whatever style is agreed upon. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 const size_t sha1HashSize = 20; | 27 const size_t sha1HashSize = 20; |
| 28 enum HashAlgorithm { | 28 enum HashAlgorithm { |
| 29 HashAlgorithmSha1, | 29 HashAlgorithmSha1, |
| 30 HashAlgorithmSha256, | 30 HashAlgorithmSha256, |
| 31 HashAlgorithmSha384, | 31 HashAlgorithmSha384, |
| 32 HashAlgorithmSha512 | 32 HashAlgorithmSha512 |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t
length, DigestValue& digestResult); | 35 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t
length, DigestValue& digestResult); |
| 36 // Note: this will never return null. |
| 36 PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm)
; | 37 PLATFORM_EXPORT std::unique_ptr<WebCryptoDigestor> createDigestor(HashAlgorithm)
; |
| 37 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul
t); | 38 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul
t); |
| 38 | 39 |
| 39 } // namespace blink | 40 } // namespace blink |
| 40 | 41 |
| 41 namespace WTF { | 42 namespace WTF { |
| 42 | 43 |
| 43 struct DigestValueHash { | 44 struct DigestValueHash { |
| 44 STATIC_ONLY(DigestValueHash); | 45 STATIC_ONLY(DigestValueHash); |
| 45 static unsigned hash(const blink::DigestValue& v) | 46 static unsigned hash(const blink::DigestValue& v) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 STATIC_ONLY(DefaultHash); | 64 STATIC_ONLY(DefaultHash); |
| 64 typedef IntHash<blink::HashAlgorithm> Hash; | 65 typedef IntHash<blink::HashAlgorithm> Hash; |
| 65 }; | 66 }; |
| 66 template <> | 67 template <> |
| 67 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H
ashAlgorithm> { | 68 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H
ashAlgorithm> { |
| 68 STATIC_ONLY(HashTraits); | 69 STATIC_ONLY(HashTraits); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace WTF | 72 } // namespace WTF |
| 72 #endif // SOURCE_PLATFORM_CRYPTO_H_ | 73 #endif // SOURCE_PLATFORM_CRYPTO_H_ |
| OLD | NEW |