28#ifndef CRYPT_HASHGEN_IMPL_H
29#define CRYPT_HASHGEN_IMPL_H
32#define ROUNDS_DEFAULT 5000
33#define ROUNDS_MIN ROUNDS_DEFAULT
34#define ROUNDS_MAX (0xFFF * 1000)
37#define SHA2_ROUNDS_DEFAULT 10000
38#define SHA2_ROUNDS_MIN 5000
39#define SHA2_ROUNDS_MAX (0xFFF * 1000)
42#define CRYPT_SALT_LENGTH 20
43#define CRYPT_MAGIC_LENGTH 3
44#define CRYPT_PARAM_LENGTH 13
45#define SHA256_HASH_LENGTH 43
46#define CRYPT_MAX_PASSWORD_SIZE \
47 (CRYPT_SALT_LENGTH + SHA256_HASH_LENGTH + CRYPT_MAGIC_LENGTH + \
49#define MAX_PLAINTEXT_LENGTH 256
56char *
my_crypt_genhash(
char *ctbuffer,
size_t ctbufflen,
const char *plaintext,
57 size_t plaintext_len,
const char *switchsalt,
58 const char **params,
unsigned int *num_rounds =
nullptr);
60void xor_string(
char *to,
int to_len,
char *pattern,
int pattern_len);
void my_make_scrambled_password(char *to, const char *password, size_t pass_len)
Definition: crypt_genhash_impl.cc:444
void xor_string(char *to, int to_len, char *pattern, int pattern_len)
Definition: crypt_genhash_impl.cc:435
void generate_user_salt(char *buffer, int buffer_len)
Generate a random string using ASCII characters but avoid separator character.
Definition: crypt_genhash_impl.cc:422
char * my_crypt_genhash(char *ctbuffer, size_t ctbufflen, const char *plaintext, size_t plaintext_len, const char *switchsalt, const char **params, unsigned int *num_rounds=nullptr)
Definition: crypt_genhash_impl.cc:235
int extract_user_salt(const char **salt_begin, const char **salt_end)
Finds the interval which envelopes the user salt in a crypt password The crypt format is assumed to b...
Definition: crypt_genhash_impl.cc:187
static char * password
Definition: mysql_secure_installation.cc:58
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418