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_METRICS_CRC32_H_ 6 #define BASE_METRICS_CRC32_H_ 7 8 #include <stddef.h> 9 #include <stdint.h> 10 11 #include "base/base_export.h" 12 #include "base/containers/span.h" 13 14 namespace base { 15 16 BASE_EXPORT extern const uint32_t kCrcTable[256]; 17 18 // This provides a simple, fast CRC-32 calculation that can be used for checking 19 // the integrity of data. It is not a "secure" calculation! |sum| can start 20 // with any seed or be used to continue an operation began with previous data. 21 BASE_EXPORT uint32_t Crc32(uint32_t sum, span<const uint8_t> data); 22 23 } // namespace base 24 25 #endif // BASE_METRICS_CRC32_H_ 26