#include "net/disk_cache/simple/simple_util.h"
#include <string.h>
#include <limits>
#include <string_view>
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/hash/sha1.h"
#include "base/numerics/byte_conversions.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "net/disk_cache/simple/simple_entry_format.h"
#include "third_party/zlib/zlib.h"
namespace {
const size_t kEntryHashKeyAsHexStringSize = …;
}
namespace disk_cache::simple_util {
std::string ConvertEntryHashKeyToHexString(uint64_t hash_key) { … }
std::string GetEntryHashKeyAsHexString(const std::string& key) { … }
bool GetEntryHashKeyFromHexString(std::string_view hash_key,
uint64_t* hash_key_out) { … }
uint64_t GetEntryHashKey(const std::string& key) { … }
std::string GetFilenameFromEntryFileKeyAndFileIndex(
const SimpleFileTracker::EntryFileKey& key,
int file_index) { … }
std::string GetSparseFilenameFromEntryFileKey(
const SimpleFileTracker::EntryFileKey& key) { … }
std::string GetFilenameFromKeyAndFileIndex(const std::string& key,
int file_index) { … }
size_t GetHeaderSize(size_t key_length) { … }
int32_t GetDataSizeFromFileSize(size_t key_length, int64_t file_size) { … }
int64_t GetFileSizeFromDataSize(size_t key_length, int32_t data_size) { … }
int GetFileIndexFromStreamIndex(int stream_index) { … }
uint32_t Crc32(base::span<const uint8_t> data) { … }
uint32_t Crc32(const char* data, int length) { … }
uint32_t IncrementalCrc32(uint32_t previous_crc, const char* data, int length) { … }
}