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

Side by Side Diff: omaha_hash_calculator.h

Issue 4042004: AU: When applying delta locally, get source checksums (Closed) Base URL: http://git.chromium.org/git/update_engine.git
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 static bool RawHashOfData(const std::vector<char>& data, 63 static bool RawHashOfData(const std::vector<char>& data,
64 std::vector<char>* out_hash); 64 std::vector<char>* out_hash);
65 static off_t RawHashOfFile(const std::string& name, off_t length, 65 static off_t RawHashOfFile(const std::string& name, off_t length,
66 std::vector<char>* out_hash); 66 std::vector<char>* out_hash);
67 67
68 // Used by tests 68 // Used by tests
69 static std::string OmahaHashOfBytes(const void* data, size_t length); 69 static std::string OmahaHashOfBytes(const void* data, size_t length);
70 static std::string OmahaHashOfString(const std::string& str); 70 static std::string OmahaHashOfString(const std::string& str);
71 static std::string OmahaHashOfData(const std::vector<char>& data); 71 static std::string OmahaHashOfData(const std::vector<char>& data);
72 72
73 static bool Base64Encode(const void* data, size_t size, std::string* out);
74
73 private: 75 private:
74 // If non-empty, the final base64 encoded hash and the raw hash. Will only be 76 // If non-empty, the final base64 encoded hash and the raw hash. Will only be
75 // set to non-empty when Finalize is called. 77 // set to non-empty when Finalize is called.
76 std::string hash_; 78 std::string hash_;
77 std::vector<char> raw_hash_; 79 std::vector<char> raw_hash_;
78 80
79 // Init success 81 // Init success
80 bool valid_; 82 bool valid_;
81 83
82 // The hash state used by OpenSSL 84 // The hash state used by OpenSSL
83 SHA256_CTX ctx_; 85 SHA256_CTX ctx_;
84 DISALLOW_COPY_AND_ASSIGN(OmahaHashCalculator); 86 DISALLOW_COPY_AND_ASSIGN(OmahaHashCalculator);
85 }; 87 };
86 88
87 } // namespace chromeos_update_engine 89 } // namespace chromeos_update_engine
88 90
89 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__ 91 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698