23 lines
614 B
C++
23 lines
614 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <array>
|
|
#include <string>
|
|
|
|
typedef struct {
|
|
uint64_t size; // Size of input in bytes
|
|
uint32_t buffer[4]; // Current accumulation of hash
|
|
uint8_t input[64]; // Input to be used in the next step
|
|
|
|
uint8_t digest[16]; // Result of algorithm
|
|
}MD5Context;
|
|
typedef std::array<uint8_t, 16> MD5Digest;
|
|
|
|
void md5Init(MD5Context* ctx);
|
|
void md5Update(MD5Context* ctx, uint8_t* input, size_t input_len);
|
|
MD5Digest md5Finalize(MD5Context* ctx);
|
|
|
|
std::string md5ToString(const MD5Digest& digest);
|
|
bool string2MD5(const char* md5_string, MD5Digest& md5);
|
|
|