mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-08 20:12:56 -04:00
chore(checksum): remove unused code
This commit is contained in:
parent
0156f64e51
commit
e4f1fdfcc6
@ -34,7 +34,6 @@ namespace dwarfs {
|
||||
class checksum {
|
||||
public:
|
||||
enum class algorithm {
|
||||
SHA1,
|
||||
SHA2_512_256,
|
||||
XXH3_64,
|
||||
XXH3_128,
|
||||
@ -56,8 +55,6 @@ class checksum {
|
||||
|
||||
bool finalize(void* digest) const { return impl_->finalize(digest); }
|
||||
|
||||
bool verify(void const* digest) const;
|
||||
|
||||
size_t digest_size() const { return impl_->digest_size(); }
|
||||
|
||||
class impl {
|
||||
|
@ -193,9 +193,6 @@ bool checksum::verify(algorithm alg, void const* data, size_t size,
|
||||
|
||||
checksum::checksum(algorithm alg) {
|
||||
switch (alg) {
|
||||
case algorithm::SHA1:
|
||||
impl_ = std::make_unique<checksum_evp>(::EVP_sha1());
|
||||
break;
|
||||
case algorithm::SHA2_512_256:
|
||||
impl_ = std::make_unique<checksum_evp>(::EVP_sha512_256());
|
||||
break;
|
||||
@ -223,10 +220,4 @@ checksum::checksum(std::string const& alg) {
|
||||
}
|
||||
}
|
||||
|
||||
bool checksum::verify(void const* digest) const {
|
||||
std::array<char, EVP_MAX_MD_SIZE> tmp;
|
||||
return impl_->finalize(tmp.data()) &&
|
||||
::memcmp(digest, tmp.data(), impl_->digest_size()) == 0;
|
||||
}
|
||||
|
||||
} // namespace dwarfs
|
||||
|
Loading…
x
Reference in New Issue
Block a user