| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Utility class for calculating the HMAC for a given message. We currently | 5 // Utility class for calculating the HMAC for a given message. We currently |
| 6 // only support SHA1 for the hash algorithm, but this can be extended easily. | 6 // only support SHA1 for the hash algorithm, but this can be extended easily. |
| 7 | 7 |
| 8 #ifndef CRYPTO_HMAC_H_ | 8 #ifndef CRYPTO_HMAC_H_ |
| 9 #define CRYPTO_HMAC_H_ | 9 #define CRYPTO_HMAC_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
| 16 #include "crypto/crypto_api.h" | 16 #include "crypto/crypto_export.h" |
| 17 | 17 |
| 18 namespace crypto { | 18 namespace crypto { |
| 19 | 19 |
| 20 // Simplify the interface and reduce includes by abstracting out the internals. | 20 // Simplify the interface and reduce includes by abstracting out the internals. |
| 21 struct HMACPlatformData; | 21 struct HMACPlatformData; |
| 22 | 22 |
| 23 class CRYPTO_API HMAC { | 23 class CRYPTO_EXPORT HMAC { |
| 24 public: | 24 public: |
| 25 // The set of supported hash functions. Extend as required. | 25 // The set of supported hash functions. Extend as required. |
| 26 enum HashAlgorithm { | 26 enum HashAlgorithm { |
| 27 SHA1, | 27 SHA1, |
| 28 SHA256, | 28 SHA256, |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 explicit HMAC(HashAlgorithm hash_alg); | 31 explicit HMAC(HashAlgorithm hash_alg); |
| 32 ~HMAC(); | 32 ~HMAC(); |
| 33 | 33 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 private: | 74 private: |
| 75 HashAlgorithm hash_alg_; | 75 HashAlgorithm hash_alg_; |
| 76 scoped_ptr<HMACPlatformData> plat_; | 76 scoped_ptr<HMACPlatformData> plat_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(HMAC); | 78 DISALLOW_COPY_AND_ASSIGN(HMAC); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace crypto | 81 } // namespace crypto |
| 82 | 82 |
| 83 #endif // CRYPTO_HMAC_H_ | 83 #endif // CRYPTO_HMAC_H_ |
| OLD | NEW |