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

Unified Diff: blimp/common/blob_cache/id_util.h

Issue 1912153004: [blimp] Change to use SHA-256 instead of SHA-1 for unique ids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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 side-by-side diff with in-line comments
Download patch
Index: blimp/common/blob_cache/id_util.h
diff --git a/blimp/common/blob_cache/id_util.h b/blimp/common/blob_cache/id_util.h
index 902d48a3bd4a4af85a5cae5d880fb3aeb6888d6f..cdfa4f6c2c611bbb8130a4ad23c70ad411c7c048 100644
--- a/blimp/common/blob_cache/id_util.h
+++ b/blimp/common/blob_cache/id_util.h
@@ -13,14 +13,17 @@
namespace blimp {
-// Returns the bytes of a SHA1 hash of the input. The string is guaranteed
-// to have length base::kSHA1Length.
+// Returns the bytes of a SHA-256 hash of the input. The string is guaranteed
+// to have length crypto::kSHA256Length.
Wez 2016/04/23 00:08:52 The length of the string is only interesting in te
nyquist 2016/04/25 08:11:17 Agreed! Done.
BLIMP_COMMON_EXPORT const BlobId CalculateBlobId(const void* data,
size_t data_size);
-// Returns a hexadecimal string representation of a SHA1 hash. The input is
-// required to have length base::kSHA1Length.
-BLIMP_COMMON_EXPORT const std::string FormatBlobId(const BlobId& data);
+// Returns a hexadecimal string representation of a SHA-256 hash. The input is
Wez 2016/04/23 00:08:52 "... of a BlobId."
nyquist 2016/04/25 08:11:17 Done.
+// required to have length crypto::kSHA256Length.
+BLIMP_COMMON_EXPORT const std::string FormatBlobId(const BlobId& id);
Wez 2016/04/23 00:08:52 Suggest BlobIdToString rather than "format"; forma
nyquist 2016/04/25 08:11:17 Done.
+
+// Returns whether the BlobId has the required length crypto::kSHA256Length.
+BLIMP_COMMON_EXPORT bool BlobIdHasCorrectLength(const BlobId& id);
Wez 2016/04/23 00:08:52 Suggest naming this IsValidBlobId - then the Forma
nyquist 2016/04/25 08:11:17 Awesome suggestion! Done.
} // namespace blimp

Powered by Google App Engine
This is Rietveld 408576698