TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
checksum.h
1 /*
2  * Copyright (c) 2017-present, Facebook, Inc.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #pragma once
9 
10 #include <string>
11 #include <string_view>
12 #include <vector>
13 
14 namespace common {
15 
16 std::string toHex(std::vector<uint8_t> const& digest);
17 
18 std::vector<uint8_t> sha256sum(void const* data, size_t len);
19 inline std::vector<uint8_t> sha256sum(std::string_view data) {
20  return sha256sum(data.data(), data.size());
21 }
22 inline std::vector<uint8_t> sha256sum(std::vector<uint8_t> const& data) {
23  return sha256sum(data.data(), data.size());
24 }
25 
26 std::vector<uint8_t> md5sum(void const* data, size_t len);
27 inline std::vector<uint8_t> md5sum(std::string_view data) {
28  return md5sum(data.data(), data.size());
29 }
30 inline std::vector<uint8_t> md5sum(std::vector<uint8_t> const& data) {
31  return md5sum(data.data(), data.size());
32 }
33 
34 } // namespace common
std::vector< uint8_t > md5sum(void const *data, size_t len)
Definition: checksum.cpp:35
std::vector< uint8_t > sha256sum(void const *data, size_t len)
Definition: checksum.cpp:26
General utilities.
Definition: assert.cpp:7
std::string toHex(std::vector< uint8_t > const &digest)
Definition: checksum.cpp:15