| 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 #ifndef BASE_CRYPTO_SECURE_HASH_H_ | 5 #ifndef CRYPTO_SECURE_HASH_H_ |
| 6 #define BASE_CRYPTO_SECURE_HASH_H_ | 6 #define CRYPTO_SECURE_HASH_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_api.h" | |
| 10 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 11 | 10 |
| 12 namespace base { | 11 namespace crypto { |
| 13 | 12 |
| 14 // A wrapper to calculate secure hashes incrementally, allowing to | 13 // A wrapper to calculate secure hashes incrementally, allowing to |
| 15 // be used when the full input is not known in advance. | 14 // be used when the full input is not known in advance. |
| 16 class BASE_API SecureHash { | 15 class SecureHash { |
| 17 public: | 16 public: |
| 18 enum Algorithm { | 17 enum Algorithm { |
| 19 SHA256, | 18 SHA256, |
| 20 }; | 19 }; |
| 21 virtual ~SecureHash() {} | 20 virtual ~SecureHash() {} |
| 22 | 21 |
| 23 static SecureHash* Create(Algorithm type); | 22 static SecureHash* Create(Algorithm type); |
| 24 | 23 |
| 25 virtual void Update(const void* input, size_t len) = 0; | 24 virtual void Update(const void* input, size_t len) = 0; |
| 26 virtual void Finish(void* output, size_t len) = 0; | 25 virtual void Finish(void* output, size_t len) = 0; |
| 27 | 26 |
| 28 protected: | 27 protected: |
| 29 SecureHash() {} | 28 SecureHash() {} |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(SecureHash); | 31 DISALLOW_COPY_AND_ASSIGN(SecureHash); |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 } // namespace base | 34 } // namespace crypto |
| 36 | 35 |
| 37 #endif // BASE_CRYPTO_SECURE_HASH_H_ | 36 #endif // CRYPTO_SECURE_HASH_H_ |
| OLD | NEW |