24 lines
411 B
C++
24 lines
411 B
C++
#ifndef SHA1_H
|
|
#define SHA1_H
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
class SHA1 {
|
|
public:
|
|
static const size_t HASH_SIZE = 20;
|
|
static const size_t BLOCK_SIZE = 64;
|
|
|
|
SHA1();
|
|
void update(const uint8_t* data, size_t length);
|
|
void finalize(uint8_t* hash);
|
|
|
|
private:
|
|
void transform(const uint8_t* block);
|
|
uint32_t state[5];
|
|
uint8_t buffer[64];
|
|
uint64_t count;
|
|
};
|
|
|
|
#endif // SHA1_H
|