From e376b337f87c171ab0c8784205a197322f8ca02a Mon Sep 17 00:00:00 2001 From: Alexey Arno Date: Tue, 29 Mar 2016 19:30:28 +0300 Subject: [PATCH] dbms: Removed obsolete files. [#METR-18510] --- dbms/include/DB/Common/SHA512Utils.h | 13 ----- dbms/src/Common/SHA512Utils.cpp | 84 ---------------------------- 2 files changed, 97 deletions(-) delete mode 100644 dbms/include/DB/Common/SHA512Utils.h delete mode 100644 dbms/src/Common/SHA512Utils.cpp diff --git a/dbms/include/DB/Common/SHA512Utils.h b/dbms/include/DB/Common/SHA512Utils.h deleted file mode 100644 index e345ebaca2b..00000000000 --- a/dbms/include/DB/Common/SHA512Utils.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -namespace SHA512Utils -{ - -void updateHash(SHA512_CTX & ctx, const std::string & path); -std::string computeHashFromString(const std::string & in); -std::string computeHashFromFolder(const std::string & path); - -} diff --git a/dbms/src/Common/SHA512Utils.cpp b/dbms/src/Common/SHA512Utils.cpp deleted file mode 100644 index df5644bd0fb..00000000000 --- a/dbms/src/Common/SHA512Utils.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -namespace SHA512Utils -{ - -void updateHash(SHA512_CTX & ctx, const std::string & path) -{ - constexpr size_t buffer_size = 1024; - - std::deque to_process; - to_process.push_back(path); - - while (!to_process.empty()) - { - std::string filename = to_process.front(); - Poco::File cur{filename}; - to_process.pop_front(); - - if (cur.isFile()) - { - DB::ReadBufferFromFile buf{filename}; - while (!buf.eof()) - { - std::array in; - size_t read_count = buf.read(in.data(), in.size()); - SHA512_Update(&ctx, reinterpret_cast(in.data()), read_count); - } - } - else - { - std::vector files; - cur.list(files); - for (const auto & file : files) - to_process.push_back(path + "/" + file); - } - } -} - -std::string computeHashFromString(const std::string & in) -{ - unsigned char hash[SHA512_DIGEST_LENGTH]; - - SHA512_CTX ctx; - SHA512_Init(&ctx); - SHA512_Update(&ctx, reinterpret_cast(in.data()), in.size()); - SHA512_Final(hash, &ctx); - - std::string out; - { - DB::WriteBufferFromString buf{out}; - DB::HexWriteBuffer hex_buf{buf}; - hex_buf.write(reinterpret_cast(hash), sizeof(hash)); - } - - return out; -} - -std::string computeHashFromFolder(const std::string & path) -{ - unsigned char hash[SHA512_DIGEST_LENGTH]; - - SHA512_CTX ctx; - SHA512_Init(&ctx); - updateHash(ctx, path); - SHA512_Final(hash, &ctx); - - std::string out; - { - DB::WriteBufferFromString buf{out}; - DB::HexWriteBuffer hex_buf{buf}; - hex_buf.write(reinterpret_cast(hash), sizeof(hash)); - } - - return out; -} - -}