28#ifndef CRYPT_HASHGEN_IMPL_H
29#define CRYPT_HASHGEN_IMPL_H
30#define ROUNDS_DEFAULT 5000
31#define ROUNDS_MIN ROUNDS_DEFAULT
32#define ROUNDS_MAX (0xFFF * 1000)
34#define CRYPT_SALT_LENGTH 20
35#define CRYPT_MAGIC_LENGTH 3
36#define CRYPT_PARAM_LENGTH 13
37#define SHA256_HASH_LENGTH 43
38#define CRYPT_MAX_PASSWORD_SIZE \
39 (CRYPT_SALT_LENGTH + SHA256_HASH_LENGTH + CRYPT_MAGIC_LENGTH + \
41#define MAX_PLAINTEXT_LENGTH 256
48char *
my_crypt_genhash(
char *ctbuffer,
size_t ctbufflen,
const char *plaintext,
49 size_t plaintext_len,
const char *switchsalt,
50 const char **params,
unsigned int *num_rounds =
nullptr);
52void xor_string(
char *to,
int to_len,
char *pattern,
int pattern_len);
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
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420