summaryrefslogtreecommitdiffstats
path: root/base/sha2.cc
diff options
context:
space:
mode:
authorbryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-24 17:45:21 +0000
committerbryner@chromium.org <bryner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-24 17:45:21 +0000
commit6c683f09fd3c1e0b7565b6c93d639b9840e7c1f8 (patch)
tree8966794d268cd876c5497e06c3b7a27409338a52 /base/sha2.cc
parent4c9a3f412bd09d6378106b37662320d79a6b82ca (diff)
downloadchromium_src-6c683f09fd3c1e0b7565b6c93d639b9840e7c1f8.zip
chromium_src-6c683f09fd3c1e0b7565b6c93d639b9840e7c1f8.tar.gz
chromium_src-6c683f09fd3c1e0b7565b6c93d639b9840e7c1f8.tar.bz2
Fix a bug in the string wrapper for SHA256HashString.
The wrapper was using the size of the input string as the number of hash bytes to compute, rather than the size of the output string (SHA256_LENGTH). Added a test for this. BUG=none TEST=Sha256Test.Test1_String Review URL: http://codereview.chromium.org/3492008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sha2.cc')
-rw-r--r--base/sha2.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/sha2.cc b/base/sha2.cc
index 47d381b..c0fd0ab 100644
--- a/base/sha2.cc
+++ b/base/sha2.cc
@@ -22,7 +22,7 @@ void SHA256HashString(const std::string& str, void* output, size_t len) {
std::string SHA256HashString(const std::string& str) {
std::string output(SHA256_LENGTH, 0);
- SHA256HashString(str, string_as_array(&output), str.size());
+ SHA256HashString(str, string_as_array(&output), output.size());
return output;
}