#include <stddef.h>
#include "my_macros.h"
 
Go to the source code of this file.
 | 
| 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 be $a$bbbb$cccccc\0 and the salt is found by counting the delimiters and marking begin and end.  More...
  | 
|   | 
| 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) | 
|   | 
| void  | generate_user_salt (char *buffer, int buffer_len) | 
|   | Generate a random string using ASCII characters but avoid separator character.  More...
  | 
|   | 
| void  | xor_string (char *to, int to_len, char *pattern, int pattern_len) | 
|   | 
◆ CRYPT_MAGIC_LENGTH
      
        
          | #define CRYPT_MAGIC_LENGTH   3 | 
        
      
 
 
◆ CRYPT_MAX_PASSWORD_SIZE
      
        
          | #define CRYPT_MAX_PASSWORD_SIZE | 
        
      
 
Value:
   CRYPT_PARAM_LENGTH)
#define CRYPT_SALT_LENGTH
Definition: crypt_genhash_impl.h:34
 
#define SHA256_HASH_LENGTH
Definition: crypt_genhash_impl.h:37
 
#define CRYPT_MAGIC_LENGTH
Definition: crypt_genhash_impl.h:35
 
 
 
 
◆ CRYPT_PARAM_LENGTH
      
        
          | #define CRYPT_PARAM_LENGTH   13 | 
        
      
 
 
◆ CRYPT_SALT_LENGTH
      
        
          | #define CRYPT_SALT_LENGTH   20 | 
        
      
 
 
◆ MAX_PLAINTEXT_LENGTH
      
        
          | #define MAX_PLAINTEXT_LENGTH   256 | 
        
      
 
 
◆ MIXCHARS
◆ ROUNDS_DEFAULT
      
        
          | #define ROUNDS_DEFAULT   5000 | 
        
      
 
 
◆ ROUNDS_MAX
      
        
          | #define ROUNDS_MAX   (0xFFF * 1000) | 
        
      
 
 
◆ ROUNDS_MIN
◆ SHA256_HASH_LENGTH
      
        
          | #define SHA256_HASH_LENGTH   43 | 
        
      
 
 
◆ extract_user_salt()
      
        
          | 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 be $a$bbbb$cccccc\0 and the salt is found by counting the delimiters and marking begin and end. 
- Parameters
 - 
  
    | [in,out] | salt_begin | As input, pointer to start of crypt passwd, as output, pointer to first byte of the salt  | 
    | [in,out] | salt_end | As input, pointer to the last byte in passwd, as output, pointer to the byte immediately following the salt ($) | 
  
   
- Returns
 - The size of the salt identified 
 
 
 
◆ generate_user_salt()
      
        
          | void generate_user_salt  | 
          ( | 
          char *  | 
          buffer,  | 
        
        
           | 
           | 
          int  | 
          buffer_len  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Generate a random string using ASCII characters but avoid separator character. 
Stdlib rand and srand are used to produce pseudo random numbers between with about 7 bit worth of entropty between 1-127. 
 
 
◆ my_crypt_genhash()
      
        
          | 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  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ xor_string()
      
        
          | void xor_string  | 
          ( | 
          char *  | 
          to,  | 
        
        
           | 
           | 
          int  | 
          to_len,  | 
        
        
           | 
           | 
          char *  | 
          pattern,  | 
        
        
           | 
           | 
          int  | 
          pattern_len  | 
        
        
           | 
          ) | 
           |  |