| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #ifndef NETTLE_BLOWFISH_H_INCLUDED |
| | #define NETTLE_BLOWFISH_H_INCLUDED |
| |
|
| | #include "nettle-types.h" |
| |
|
| | #ifdef __cplusplus |
| | extern "C" { |
| | #endif |
| |
|
| | |
| | #define blowfish_set_key nettle_blowfish_set_key |
| | #define blowfish128_set_key nettle_blowfish128_set_key |
| | #define blowfish_encrypt nettle_blowfish_encrypt |
| | #define blowfish_decrypt nettle_blowfish_decrypt |
| | #define blowfish_bcrypt_hash nettle_blowfish_bcrypt_hash |
| | #define blowfish_bcrypt_verify nettle_blowfish_bcrypt_verify |
| |
|
| | #define BLOWFISH_BLOCK_SIZE 8 |
| |
|
| | |
| | #define BLOWFISH_MIN_KEY_SIZE 8 |
| | #define BLOWFISH_MAX_KEY_SIZE 56 |
| |
|
| | |
| | #define BLOWFISH_KEY_SIZE 16 |
| |
|
| | #define BLOWFISH128_KEY_SIZE 16 |
| |
|
| | #define _BLOWFISH_ROUNDS 16 |
| |
|
| | #define BLOWFISH_BCRYPT_HASH_SIZE (60 + 1) |
| | #define BLOWFISH_BCRYPT_BINSALT_SIZE 16 |
| |
|
| | struct blowfish_ctx |
| | { |
| | uint32_t s[4][256]; |
| | uint32_t p[_BLOWFISH_ROUNDS+2]; |
| | }; |
| |
|
| | |
| | int |
| | blowfish_set_key(struct blowfish_ctx *ctx, |
| | size_t length, const uint8_t *key); |
| | int |
| | blowfish128_set_key(struct blowfish_ctx *ctx, const uint8_t *key); |
| |
|
| | void |
| | blowfish_encrypt(const struct blowfish_ctx *ctx, |
| | size_t length, uint8_t *dst, |
| | const uint8_t *src); |
| | void |
| | blowfish_decrypt(const struct blowfish_ctx *ctx, |
| | size_t length, uint8_t *dst, |
| | const uint8_t *src); |
| |
|
| | |
| | |
| | int |
| | blowfish_bcrypt_hash(uint8_t *dst, |
| | size_t lenkey, const uint8_t *key, |
| | size_t lenscheme, const uint8_t *scheme, |
| | int log2rounds, |
| | const uint8_t *salt); |
| | int |
| | blowfish_bcrypt_verify(size_t lenkey, const uint8_t *key, |
| | size_t lenhashed, const uint8_t *hashed); |
| |
|
| | #ifdef __cplusplus |
| | } |
| | #endif |
| |
|
| | #endif |
| |
|