2020-11-11 00:13:09 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/ui/view.hpp>
|
2020-11-11 00:13:09 +01:00
|
|
|
|
2021-10-26 17:21:48 +02:00
|
|
|
#include <array>
|
|
|
|
#include <utility>
|
2020-11-11 00:13:09 +01:00
|
|
|
#include <cstdio>
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2020-11-11 00:13:09 +01:00
|
|
|
|
|
|
|
class ViewHashes : public View {
|
|
|
|
public:
|
2020-12-27 15:39:06 +01:00
|
|
|
explicit ViewHashes();
|
2020-11-11 09:28:44 +01:00
|
|
|
~ViewHashes() override;
|
2020-11-11 00:13:09 +01:00
|
|
|
|
2020-12-22 18:10:01 +01:00
|
|
|
void drawContent() override;
|
2020-11-11 00:13:09 +01:00
|
|
|
|
|
|
|
private:
|
2022-03-04 20:52:39 +01:00
|
|
|
enum class HashFunctions
|
|
|
|
{
|
2022-01-24 20:53:17 +01:00
|
|
|
Crc8,
|
|
|
|
Crc16,
|
|
|
|
Crc32,
|
|
|
|
Md5,
|
|
|
|
Sha1,
|
|
|
|
Sha224,
|
|
|
|
Sha256,
|
|
|
|
Sha384,
|
|
|
|
Sha512
|
|
|
|
};
|
2021-10-26 17:21:48 +02:00
|
|
|
|
2022-02-01 22:09:44 +01:00
|
|
|
bool m_shouldInvalidate = true;
|
|
|
|
int m_currHashFunction = 0;
|
|
|
|
u64 m_hashRegion[2] = { 0 };
|
2020-11-28 15:53:11 +01:00
|
|
|
bool m_shouldMatchSelection = false;
|
|
|
|
|
2021-10-26 17:21:48 +02:00
|
|
|
static constexpr std::array hashFunctionNames {
|
2022-01-24 20:53:17 +01:00
|
|
|
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"},
|
2021-10-26 17:21:48 +02:00
|
|
|
};
|
2020-11-11 00:13:09 +01:00
|
|
|
};
|
|
|
|
|
2021-10-26 17:21:48 +02:00
|
|
|
}
|