Index: components/crx_file/id_util.cc |
diff --git a/components/crx_file/id_util.cc b/components/crx_file/id_util.cc |
index ef271ad1456a2ffa8b2405f87e3aa073a419dbb9..6209cb4a7342b3d4d4fd6af80e54df42ce9e5b16 100644 |
--- a/components/crx_file/id_util.cc |
+++ b/components/crx_file/id_util.cc |
@@ -5,6 +5,7 @@ |
#include "components/crx_file/id_util.h" |
#include "base/files/file_path.h" |
+#include "base/sha1.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_util.h" |
#include "crypto/sha2.h" |
@@ -53,6 +54,12 @@ std::string GenerateIdForPath(const base::FilePath& path) { |
return GenerateId(path_bytes); |
} |
+std::string HashedIdInHex(const std::string& id) { |
+ const std::string id_hash = base::SHA1HashString(id); |
+ DCHECK_EQ(base::kSHA1Length, id_hash.length()); |
+ return base::HexEncode(id_hash.c_str(), id_hash.length()); |
+} |
+ |
base::FilePath MaybeNormalizePath(const base::FilePath& path) { |
#if defined(OS_WIN) |
// Normalize any drive letter to upper-case. We do this for consistency with |