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