Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
..
README.md 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hash.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hash.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hash_perftest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hash_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
legacy_hash.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
legacy_hash.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
legacy_hash_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_boringssl.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_boringssl.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_constexpr.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_constexpr_internal.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_constexpr_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_nacl.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_nacl.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
md5_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1_boringssl.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1_boringssl.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1_nacl.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1_nacl.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
sha1_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago

README.md

Choosing A Hash Function

Note: this document is still very much a work-in-progress. Currently missing:

  • recommendations for hashed containers
  • recommendations for a better persistent hash
  • recommendations for a secure hash

If a hash function with unchanging output is needed, please select from one of the unchanging forever options below.

Non-cryptographic

name input output unchanging forever notes
Hash() overloaded uint32_t no This function is currently being updated to return size_t.
PersistentHash() overloaded uint32_t yes Fairly weak but widely used for persisted hashes.
CityHash64() base::span<const uint8_t> uint64_t yes (note 1) Version 1.0.3. Has some known weaknesses.
CityHash64WithSeed() base::span<const uint8_t> uint64_t yes (note 1) Version 1.0.3. Has some known weaknesses.

Cryptographic

There are no hashes in //base that provide cryptographic security.

name input output unchanging forever notes
MD5String() std::string std::string yes INSECURE
SHA1HashString std::string std::string yes INSECURE

Deprecated

Note: CRC32, Murmur2, and Murmur3 will be listed here.

Note 1: While CityHash is not guaranteed unchanging forever, the version used in Chrome is pinned to version 1.0.3.