hash: make finish public in accumulators
This commit is contained in:
parent
5c0ac60e2f
commit
b4a07538df
@ -108,9 +108,7 @@ MD2::update (const uint8_t *data, size_t size) {
|
||||
|
||||
|
||||
MD2::digest_t
|
||||
MD2::digest (void) {
|
||||
finish ();
|
||||
|
||||
MD2::digest (void) const {
|
||||
digest_t d;
|
||||
memcpy (d.data (), X, sizeof (d));
|
||||
return d;
|
||||
|
@ -36,13 +36,12 @@ namespace util {
|
||||
void update (const uint8_t *data, size_t len);
|
||||
void update (const void *data, size_t len);
|
||||
|
||||
digest_t digest (void);
|
||||
|
||||
void finish (void);
|
||||
digest_t digest (void) const;
|
||||
void reset (void);
|
||||
|
||||
private:
|
||||
void transform (void);
|
||||
void finish (void);
|
||||
|
||||
uint64_t m_total;
|
||||
|
||||
|
@ -110,9 +110,7 @@ MD4::update (const uint8_t *data, size_t size) {
|
||||
|
||||
|
||||
MD4::digest_t
|
||||
MD4::digest (void) {
|
||||
finish ();
|
||||
|
||||
MD4::digest (void) const {
|
||||
digest_t d;
|
||||
memcpy (d.data (), ABCD.data(), sizeof (ABCD));
|
||||
return d;
|
||||
|
@ -35,12 +35,12 @@ namespace util {
|
||||
void update (const void *data, size_t len);
|
||||
void update (const uint8_t *data, size_t len);
|
||||
|
||||
digest_t digest (void);
|
||||
void finish (void);
|
||||
digest_t digest (void) const;
|
||||
void reset (void);
|
||||
|
||||
private:
|
||||
void transform (void);
|
||||
void finish (void);
|
||||
|
||||
uint64_t m_total;
|
||||
|
||||
|
@ -141,9 +141,7 @@ MD5::update (const uint8_t *data, size_t size) {
|
||||
|
||||
|
||||
MD5::digest_t
|
||||
MD5::digest (void) {
|
||||
finish ();
|
||||
|
||||
MD5::digest (void) const {
|
||||
static_assert (sizeof (ABCD) == sizeof (digest_t),
|
||||
"Hash state must be the same size as the final digest");
|
||||
|
||||
|
@ -36,12 +36,12 @@ namespace util {
|
||||
void update (const void *data, size_t len);
|
||||
void update (const uint8_t *data, size_t len);
|
||||
|
||||
digest_t digest (void);
|
||||
void finish (void);
|
||||
digest_t digest (void) const;
|
||||
void reset (void);
|
||||
|
||||
private:
|
||||
void transform (void);
|
||||
void finish (void);
|
||||
|
||||
uint64_t m_total;
|
||||
std::array<uint32_t, 4> ABCD;
|
||||
|
@ -42,7 +42,7 @@ RIPEMD::reset (void) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
RIPEMD::update(const uint8_t *data, size_t len) {
|
||||
RIPEMD::update (const uint8_t *data, size_t len) {
|
||||
CHECK_HARD (data);
|
||||
|
||||
size_t cursor = 0;
|
||||
|
@ -22,14 +22,16 @@ namespace util {
|
||||
public:
|
||||
RIPEMD();
|
||||
|
||||
void update(const uint8_t*, size_t);
|
||||
void finish(void);
|
||||
digest_t digest(void) const;
|
||||
void reset(void);
|
||||
void update (const uint8_t*, size_t);
|
||||
digest_t digest (void) const;
|
||||
void finish (void);
|
||||
void reset (void);
|
||||
|
||||
protected:
|
||||
void transform ();
|
||||
|
||||
bool m_finished;
|
||||
|
||||
uint32_t m_state[5];
|
||||
uint64_t m_length;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user