bcrypt.h File Reference

bcrypt password hashing function More...

#include "core/crypto.h"
#include "cipher/blowfish.h"

Go to the source code of this file.

Macros

#define BCRYPT_MIN_COST   3
 
#define BCRYPT_MAX_COST   31
 
#define BCRYPT_HASH_STRING_LEN   60
 

Functions

error_t bcryptHashPassword (const PrngAlgo *prngAlgo, void *prngContext, uint_t cost, const char_t *password, char_t *hash, size_t *hashLen)
 Password hashing function. More...
 
error_t bcryptVerifyPassword (const char_t *password, const char_t *hash)
 Password verification function. More...
 
error_t bcrypt (uint_t cost, const uint8_t *salt, const char_t *password, char_t *hash, size_t *hashLen)
 bcrypt algorithm More...
 
error_t eksBlowfishSetup (BlowfishContext *context, uint_t cost, const uint8_t *salt, size_t saltLen, const char_t *password, size_t passwordLen)
 Expensive key setup. More...
 

Detailed Description

bcrypt password hashing function

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.6

Definition in file bcrypt.h.

Macro Definition Documentation

◆ BCRYPT_HASH_STRING_LEN

#define BCRYPT_HASH_STRING_LEN   60

Definition at line 53 of file bcrypt.h.

◆ BCRYPT_MAX_COST

#define BCRYPT_MAX_COST   31

Definition at line 47 of file bcrypt.h.

◆ BCRYPT_MIN_COST

#define BCRYPT_MIN_COST   3

Definition at line 40 of file bcrypt.h.

Function Documentation

◆ bcrypt()

error_t bcrypt ( uint_t  cost,
const uint8_t *  salt,
const char_t password,
char_t hash,
size_t *  hashLen 
)

bcrypt algorithm

Parameters
[in]costKey expansion iteration count as a power of two
[in]saltRandom salt (16 bytes)
[in]passwordNULL-terminated password to be encoded
[out]hashNULL-terminated hash string
[out]hashLenLength of the hash string (optional parameter)
Returns
Error code

Definition at line 158 of file bcrypt.c.

◆ bcryptHashPassword()

error_t bcryptHashPassword ( const PrngAlgo prngAlgo,
void *  prngContext,
uint_t  cost,
const char_t password,
char_t hash,
size_t *  hashLen 
)

Password hashing function.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]costKey expansion iteration count as a power of two
[in]passwordNULL-terminated password to be encoded
[out]hashNULL-terminated hash string
[out]hashLenLength of the hash string (optional parameter)
Returns
Error code

Definition at line 55 of file bcrypt.c.

◆ bcryptVerifyPassword()

error_t bcryptVerifyPassword ( const char_t password,
const char_t hash 
)

Password verification function.

Parameters
[in]passwordNULL-terminated password to be checked
[in]hashNULL-terminated hash string
Returns
Error code

Definition at line 90 of file bcrypt.c.

◆ eksBlowfishSetup()

error_t eksBlowfishSetup ( BlowfishContext context,
uint_t  cost,
const uint8_t *  salt,
size_t  saltLen,
const char_t password,
size_t  passwordLen 
)

Expensive key setup.

Parameters
[in]contextPointer to the Blowfish context
[in]costKey expansion iteration count as a power of 2
[in]saltRandom salt
[in]saltLenLength of the random salt, in bytes
[in]passwordNULL-terminated password to be encoded
[in]passwordLenLength of the password, in bytes
Returns
Error code

Definition at line 243 of file bcrypt.c.