mirror of https://github.com/dnomd343/md5sum.git
Dnomd343
8 months ago
5 changed files with 95 additions and 78 deletions
@ -0,0 +1,34 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
namespace md5 { |
||||
|
|
||||
|
inline MD5& MD5::Reset() { |
||||
|
ctx_.A = MD5_A; |
||||
|
ctx_.B = MD5_B; |
||||
|
ctx_.C = MD5_C; |
||||
|
ctx_.D = MD5_D; |
||||
|
ctx_.size = 0; |
||||
|
buffer_size_ = 0; |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
inline MD5& MD5::Final() { |
||||
|
FinalImpl(buffer_, buffer_size_); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
inline MD5& MD5::Update(const std::string_view &data) { |
||||
|
return Update(data.data(), data.size()); |
||||
|
} |
||||
|
|
||||
|
inline std::string MD5::Hash(const std::string_view &data) { |
||||
|
return Hash(data.data(), data.size()); |
||||
|
} |
||||
|
|
||||
|
inline std::string MD5::Hash(const void *data, uint64_t len) { |
||||
|
MD5 md5; |
||||
|
md5.FinalImpl(data, len); |
||||
|
return md5.Digest(); |
||||
|
} |
||||
|
|
||||
|
} // namespace md5 |
Loading…
Reference in new issue