diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-12-10 15:21:46 -0800 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2022-01-01 11:52:53 -0800 |
| commit | 301bc49efe23d93cdc870508b28a6bc96be645d5 (patch) | |
| tree | 0f0af4354ccf4469e409b73866737a7b9c43dab5 /Source/Core/Common | |
| parent | 0c19f895d39b3302488acf9b6006fb524fb0e4d6 (diff) | |
Common: Remove MD5.h
It uses DiscIO, and Common shouldn't depend on DiscIO. Instead, put this code in NetPlayClient.cpp.
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | Source/Core/Common/MD5.cpp | 54 | ||||
| -rw-r--r-- | Source/Core/Common/MD5.h | 12 |
3 files changed, 0 insertions, 68 deletions
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index a2156c5b5d..5314f119f0 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -81,8 +81,6 @@ add_library(common MathUtil.h Matrix.cpp Matrix.h - MD5.cpp - MD5.h MemArena.h MemoryUtil.cpp MemoryUtil.h diff --git a/Source/Core/Common/MD5.cpp b/Source/Core/Common/MD5.cpp deleted file mode 100644 index 976d80575b..0000000000 --- a/Source/Core/Common/MD5.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 Dolphin Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "Common/MD5.h" - -#include <fstream> -#include <functional> -#include <mbedtls/md5.h> -#include <string> - -#include <fmt/format.h> - -#include "Common/StringUtil.h" -#include "DiscIO/Blob.h" - -namespace MD5 -{ -std::string MD5Sum(const std::string& file_path, std::function<bool(int)> report_progress) -{ - std::string output_string; - std::vector<u8> data(8 * 1024 * 1024); - u64 read_offset = 0; - mbedtls_md5_context ctx; - - std::unique_ptr<DiscIO::BlobReader> file(DiscIO::CreateBlobReader(file_path)); - u64 game_size = file->GetDataSize(); - - mbedtls_md5_starts_ret(&ctx); - - while (read_offset < game_size) - { - size_t read_size = std::min(static_cast<u64>(data.size()), game_size - read_offset); - if (!file->Read(read_offset, read_size, data.data())) - return output_string; - - mbedtls_md5_update_ret(&ctx, data.data(), read_size); - read_offset += read_size; - - int progress = - static_cast<int>(static_cast<float>(read_offset) / static_cast<float>(game_size) * 100); - if (!report_progress(progress)) - return output_string; - } - - std::array<u8, 16> output; - mbedtls_md5_finish_ret(&ctx, output.data()); - - // Convert to hex - for (u8 n : output) - output_string += fmt::format("{:02x}", n); - - return output_string; -} -} // namespace MD5 diff --git a/Source/Core/Common/MD5.h b/Source/Core/Common/MD5.h deleted file mode 100644 index 58eabc6816..0000000000 --- a/Source/Core/Common/MD5.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 Dolphin Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include <functional> -#include <string> - -namespace MD5 -{ -std::string MD5Sum(const std::string& file_name, std::function<bool(int)> progress); -} |
