passwordbasedauthentication.h File Reference

Go to the source code of this file.

## Data Structures

struct | PBASettings

## Macros

#define | MAX_PEPPER_SIZE 4
#define | COUNT_DEFAULT 20000
#define | PREFIX_DEFAULT "$6$"

## Enumerations

enum | pba_rc { VALID , UPDATE_RECOMMENDED , INVALID , ERR }

## Functions

struct PBASettings * | pba_init (const char *pepper, unsigned int pepper_size, unsigned int count, char *prefix)
char * | pba_hash (struct PBASettings *setting, const char *password)
enum pba_rc | pba_verify_hash (const struct PBASettings *settings, const char *hash, const char *password)
void | pba_finalize (struct PBASettings *settings)

## Macro Definition Documentation

## COUNT_DEFAULT

#define COUNT_DEFAULT 20000

## MAX_PEPPER_SIZE

#define MAX_PEPPER_SIZE 4

## PREFIX_DEFAULT

#define PREFIX_DEFAULT "$6$"

## Enumeration Type Documentation

## pba_rc

enum pba_rc

Enumerator
VALID |
UPDATE_RECOMMENDED |
INVALID |
ERR |

## Function Documentation

## pba_finalize()

void pba_finalize | ( | struct PBASettings * | settings | ) |

## pba_hash()

char * pba_hash | ( | struct PBASettings * | setting,
|  | const char * | password
| ) |  |

pba_hash tries to create a hash based SETTING and PASSWORD. Returns a hash on success or a NULL pointer on failure

## pba_init()

struct PBASettings * pba_init | ( | const char * | pepper,
|  | unsigned int | pepper_size,
|  | unsigned int | count,
|  | char * | prefix
| ) |  |

Intitializes PBASettings with given PEPPER, PREFIX, COUNT.

PEPPER_SIZE must be lower or equal MAX_PEPPER_SIZE when PEPPER is set, when PEPPER is a NULL pointer, no pepper will be used and PEPPER_SIZE is ignored.

COUNT is set to COUNT_DEFAULT when it is 0, PREFIX is set to PREFIX_DEFAULT when prefix is a nullpointer.

Returns a pointer to PBASettings on success or NULL on failure.

## pba_verify_hash()

enum pba_rc pba_verify_hash | ( | const struct PBASettings * | settings,
|  | const char * | hash,
|  | const char * | password
| ) |  |

pba_verify_hash tries to create hash based on PASSWORD and settings found via HASH and compares that with HASH.

Returns VALID if HASH and PASSWORD are correct; UPDATE_RECOMMENDED when the HASH and PASSWORD are correct but based on a deprecated algorithm; IVALID if HASH does not match PASSWORD; ERR if an unexpected error occurs.