23 const std::string itoa64 =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
28 md5_worker.
update(reinterpret_cast<const uint8_t*>(input.data()), input.size());
34 return itoa64.find_first_of(hash[3]);
38 return hash.substr(4,8);
42 if(hash.size() != 34)
return false;
46 if(iteration_count < 7 || iteration_count > 30)
return false;
56 unsigned value = input[i++];
57 encoded_hash.append(itoa64.substr(value & 0x3f,1));
59 value |=
static_cast<int>(input[
i]) << 8;
60 encoded_hash.append(itoa64.substr((value >> 6) & 0x3f,1));
64 value |=
static_cast<int>(input[
i]) << 16;
65 encoded_hash.append(itoa64.substr((value >> 12) & 0x3f,1));
68 encoded_hash.append(itoa64.substr((value >> 18) & 0x3f,1));
75 iteration_count = 1 << iteration_count;
77 std::array<uint8_t, 16>
output =
md5(salt + password);
79 output =
md5(
std::string(output.begin(), output.end()).append(password));
80 }
while(--iteration_count);
void update(const uint8_t *input, const uint32_t input_length)
GLenum GLenum GLenum input
std::array< uint8_t, 16 > md5(const std::string &input)
Returns the MD5 digest for the specified input.
std::string get_salt(const std::string &hash)
const std::string hash_prefix
std::string create_hash(const std::string &password, const std::string &salt, int iteration_count)
GLsizei const GLfloat * value
bool is_valid_hash(const std::string &hash)
static const char * output
std::array< uint8_t, 16 > raw_digest()
std::string encode_hash(const std::array< uint8_t, 16 > &input)
GLsizei const GLcharARB ** string
int get_iteration_count(const std::string &hash)