1 // Copyright 2019 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_HASH_MD5_CONSTEXPR_H_ 6 #define BASE_HASH_MD5_CONSTEXPR_H_ 7 8 #include "base/hash/md5_constexpr_internal.h" 9 10 #include <string_view> 11 12 namespace base { 13 14 // Calculates the first 32/64 bits of the MD5 digest of the provided data, 15 // returned as a uint32_t/uint64_t. When passing |string| with no explicit 16 // length the terminating null will not be processed. This abstracts away 17 // endianness so that the integer will read as the first 4 or 8 bytes of the 18 // MD5 sum, ensuring that the following outputs are equivalent for 19 // convenience: 20 // 21 // printf("%08x\n", MD5Hash32Constexpr("foo")); 22 constexpr uint64_t MD5Hash64Constexpr(std::string_view string); 23 constexpr uint32_t MD5Hash32Constexpr(std::string_view string); 24 25 } // namespace base 26 27 #endif // BASE_HASH_MD5_CONSTEXPR_H_ 28