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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 const size_t sha1HashSize = 20; | 25 const size_t sha1HashSize = 20; |
26 enum HashAlgorithm { | 26 enum HashAlgorithm { |
27 HashAlgorithmSha1, | 27 HashAlgorithmSha1, |
28 HashAlgorithmSha256, | 28 HashAlgorithmSha256, |
29 HashAlgorithmSha384, | 29 HashAlgorithmSha384, |
30 HashAlgorithmSha512 | 30 HashAlgorithmSha512 |
31 }; | 31 }; |
32 | 32 |
33 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t
length, DigestValue& digestResult); | 33 PLATFORM_EXPORT bool computeDigest(HashAlgorithm, const char* digestable, size_t
length, DigestValue& digestResult); |
34 PLATFORM_EXPORT PassOwnPtr<blink::WebCryptoDigestor> createDigestor(HashAlgorith
m); | 34 PLATFORM_EXPORT PassOwnPtr<WebCryptoDigestor> createDigestor(HashAlgorithm); |
35 PLATFORM_EXPORT void finishDigestor(blink::WebCryptoDigestor*, DigestValue& dige
stResult); | 35 PLATFORM_EXPORT void finishDigestor(WebCryptoDigestor*, DigestValue& digestResul
t); |
36 | 36 |
37 } // namespace blink | 37 } // namespace blink |
38 | 38 |
39 namespace WTF { | 39 namespace WTF { |
40 | 40 |
41 struct DigestValueHash { | 41 struct DigestValueHash { |
42 static unsigned hash(const blink::DigestValue& v) | 42 static unsigned hash(const blink::DigestValue& v) |
43 { | 43 { |
44 return StringHasher::computeHash(v.data(), v.size()); | 44 return StringHasher::computeHash(v.data(), v.size()); |
45 } | 45 } |
(...skipping 11 matching lines...) Expand all Loading... |
57 template <> | 57 template <> |
58 struct DefaultHash<blink::HashAlgorithm> { | 58 struct DefaultHash<blink::HashAlgorithm> { |
59 typedef IntHash<blink::HashAlgorithm> Hash; | 59 typedef IntHash<blink::HashAlgorithm> Hash; |
60 }; | 60 }; |
61 template <> | 61 template <> |
62 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H
ashAlgorithm> { | 62 struct HashTraits<blink::HashAlgorithm> : UnsignedWithZeroKeyHashTraits<blink::H
ashAlgorithm> { |
63 }; | 63 }; |
64 | 64 |
65 } // namespace WTF | 65 } // namespace WTF |
66 #endif // SOURCE_PLATFORM_CRYPTO_H_ | 66 #endif // SOURCE_PLATFORM_CRYPTO_H_ |
OLD | NEW |