1
0
mirror of synced 2024-11-14 19:17:42 +01:00
ImHex/plugins/builtin/include/content/views/view_hashes.hpp

51 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <hex/ui/view.hpp>
#include <array>
#include <utility>
#include <cstdio>
2021-12-07 22:47:41 +01:00
namespace hex::plugin::builtin {
class ViewHashes : public View {
public:
explicit ViewHashes();
2020-11-11 09:28:44 +01:00
~ViewHashes() override;
void drawContent() override;
private:
enum class HashFunctions
{
Crc8,
Crc16,
Crc32,
Md5,
Sha1,
Sha224,
Sha256,
Sha384,
Sha512
};
2022-02-01 22:09:44 +01:00
bool m_shouldInvalidate = true;
int m_currHashFunction = 0;
u64 m_hashRegion[2] = { 0 };
bool m_shouldMatchSelection = false;
static constexpr std::array hashFunctionNames {
std::pair {HashFunctions::Crc8, "CRC8" },
std::pair { HashFunctions::Crc16, "CRC16" },
std::pair { HashFunctions::Crc32, "CRC32" },
std::pair { HashFunctions::Md5, "MD5" },
std::pair { HashFunctions::Sha1, "SHA-1" },
std::pair { HashFunctions::Sha224, "SHA-224"},
std::pair { HashFunctions::Sha256, "SHA-256"},
std::pair { HashFunctions::Sha384, "SHA-384"},
std::pair { HashFunctions::Sha512, "SHA-512"},
};
};
}