• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace base {
11 
12 // Calculates the first 32/64 bits of the MD5 digest of the provided data,
13 // returned as a uint32_t/uint64_t. When passing |string| with no explicit
14 // length the terminating null will not be processed. This abstracts away
15 // endianness so that the integer will read as the first 4 or 8 bytes of the
16 // MD5 sum, ensuring that the following outputs are equivalent for
17 // convenience:
18 //
19 // printf("%08x\n", MD5Hash32Constexpr("foo"));
20 constexpr uint64_t MD5Hash64Constexpr(const char* string);
21 constexpr uint64_t MD5Hash64Constexpr(const char* data, uint32_t length);
22 constexpr uint32_t MD5Hash32Constexpr(const char* string);
23 constexpr uint32_t MD5Hash32Constexpr(const char* data, uint32_t length);
24 
25 }  // namespace base
26 
27 #endif  // BASE_HASH_MD5_CONSTEXPR_H_
28