Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: crypto/secure_hash.h

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crypto/scoped_test_system_nss_key_slot.cc ('k') | crypto/secure_hash_default.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CRYPTO_SECURE_HASH_H_
6 #define CRYPTO_SECURE_HASH_H_
7
8 #include "base/basictypes.h"
9 #include "crypto/crypto_export.h"
10
11 namespace base {
12 class Pickle;
13 class PickleIterator;
14 }
15
16 namespace crypto {
17
18 // A wrapper to calculate secure hashes incrementally, allowing to
19 // be used when the full input is not known in advance.
20 class CRYPTO_EXPORT SecureHash {
21 public:
22 enum Algorithm {
23 SHA256,
24 };
25 virtual ~SecureHash() {}
26
27 static SecureHash* Create(Algorithm type);
28
29 virtual void Update(const void* input, size_t len) = 0;
30 virtual void Finish(void* output, size_t len) = 0;
31
32 // Serialize the context, so it can be restored at a later time.
33 // |pickle| will contain the serialized data.
34 // Returns whether or not |pickle| was filled.
35 virtual bool Serialize(base::Pickle* pickle) = 0;
36
37 // Restore the context that was saved earlier.
38 // |data_iterator| allows this to be used as part of a larger pickle.
39 // |pickle| holds the saved data.
40 // Returns success or failure.
41 virtual bool Deserialize(base::PickleIterator* data_iterator) = 0;
42
43 protected:
44 SecureHash() {}
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(SecureHash);
48 };
49
50 } // namespace crypto
51
52 #endif // CRYPTO_SECURE_HASH_H_
OLDNEW
« no previous file with comments | « crypto/scoped_test_system_nss_key_slot.cc ('k') | crypto/secure_hash_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698