File indexing completed on 2025-01-18 10:02:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef NETTLE_BLOWFISH_H_INCLUDED
0036 #define NETTLE_BLOWFISH_H_INCLUDED
0037
0038 #include "nettle-types.h"
0039
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043
0044
0045 #define blowfish_set_key nettle_blowfish_set_key
0046 #define blowfish128_set_key nettle_blowfish128_set_key
0047 #define blowfish_encrypt nettle_blowfish_encrypt
0048 #define blowfish_decrypt nettle_blowfish_decrypt
0049 #define blowfish_bcrypt_hash nettle_blowfish_bcrypt_hash
0050 #define blowfish_bcrypt_verify nettle_blowfish_bcrypt_verify
0051
0052 #define BLOWFISH_BLOCK_SIZE 8
0053
0054
0055 #define BLOWFISH_MIN_KEY_SIZE 8
0056 #define BLOWFISH_MAX_KEY_SIZE 56
0057
0058
0059 #define BLOWFISH_KEY_SIZE 16
0060
0061 #define BLOWFISH128_KEY_SIZE 16
0062
0063 #define _BLOWFISH_ROUNDS 16
0064
0065 #define BLOWFISH_BCRYPT_HASH_SIZE (60 + 1)
0066 #define BLOWFISH_BCRYPT_BINSALT_SIZE 16
0067
0068 struct blowfish_ctx
0069 {
0070 uint32_t s[4][256];
0071 uint32_t p[_BLOWFISH_ROUNDS+2];
0072 };
0073
0074
0075 int
0076 blowfish_set_key(struct blowfish_ctx *ctx,
0077 size_t length, const uint8_t *key);
0078 int
0079 blowfish128_set_key(struct blowfish_ctx *ctx, const uint8_t *key);
0080
0081 void
0082 blowfish_encrypt(const struct blowfish_ctx *ctx,
0083 size_t length, uint8_t *dst,
0084 const uint8_t *src);
0085 void
0086 blowfish_decrypt(const struct blowfish_ctx *ctx,
0087 size_t length, uint8_t *dst,
0088 const uint8_t *src);
0089
0090
0091
0092 int
0093 blowfish_bcrypt_hash(uint8_t *dst,
0094 size_t lenkey, const uint8_t *key,
0095 size_t lenscheme, const uint8_t *scheme,
0096 int log2rounds,
0097 const uint8_t *salt);
0098 int
0099 blowfish_bcrypt_verify(size_t lenkey, const uint8_t *key,
0100 size_t lenhashed, const uint8_t *hashed);
0101
0102 #ifdef __cplusplus
0103 }
0104 #endif
0105
0106 #endif