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