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

Side by Side Diff: components/os_crypt/ie7_password_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
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 #include "components/os_crypt/ie7_password_win.h" 5 #include "components/os_crypt/ie7_password_win.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 std::wstring url_hash; 105 std::wstring url_hash;
106 106
107 // Transform the buffer to an hexadecimal string. 107 // Transform the buffer to an hexadecimal string.
108 unsigned char checksum = 0; 108 unsigned char checksum = 0;
109 for (size_t i = 0; i < hash_bin.size(); ++i) { 109 for (size_t i = 0; i < hash_bin.size(); ++i) {
110 // std::string gives signed chars, which mess with StringPrintf and 110 // std::string gives signed chars, which mess with StringPrintf and
111 // check_sum. 111 // check_sum.
112 unsigned char hash_byte = static_cast<unsigned char>(hash_bin[i]); 112 unsigned char hash_byte = static_cast<unsigned char>(hash_bin[i]);
113 checksum += hash_byte; 113 checksum += hash_byte;
114 url_hash += base::StringPrintf(L"%2.2X", static_cast<unsigned>(hash_byte)); 114 //url_hash += base::StringPrintf(L"%2.2X", static_cast<unsigned>(hash_byte)) ;
115 } 115 }
116 url_hash += base::StringPrintf(L"%2.2X", checksum); 116 //url_hash += base::StringPrintf(L"%2.2X", checksum);
117 117
118 return url_hash; 118 return url_hash;
119 } 119 }
120 120
121 bool DecryptPasswords(const std::wstring& url, 121 bool DecryptPasswords(const std::wstring& url,
122 const std::vector<unsigned char>& data, 122 const std::vector<unsigned char>& data,
123 std::vector<DecryptedCredentials>* credentials) { 123 std::vector<DecryptedCredentials>* credentials) {
124 std::wstring lower_case_url = base::ToLowerASCII(url); 124 std::wstring lower_case_url = base::ToLowerASCII(url);
125 DATA_BLOB input = {0}; 125 DATA_BLOB input = {0};
126 DATA_BLOB output = {0}; 126 DATA_BLOB output = {0};
(...skipping 18 matching lines...) Expand all
145 GetUserPassFromData(decrypted_data, credentials); 145 GetUserPassFromData(decrypted_data, credentials);
146 146
147 LocalFree(output.pbData); 147 LocalFree(output.pbData);
148 return true; 148 return true;
149 } 149 }
150 150
151 return false; 151 return false;
152 } 152 }
153 153
154 } // namespace ie7_password 154 } // namespace ie7_password
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698