bfcodec 0.0.4
Tools and a C/C++ library to manipulate BFCodec-encrypted content
Loading...
Searching...
No Matches
bfcodec.h
Go to the documentation of this file.
1
2#ifndef BFCODEC_H
3#define BFCODEC_H
4
5#include <stddef.h>
6#include <stdint.h>
7
8#if defined(_WIN32)
9#if defined(BFCODEC_EXPORTS) || defined(bfcodec_EXPORTS)
10#define BFCODEC_API __declspec(dllexport)
11#elif defined(BFCODEC_USE_DLL)
12#define BFCODEC_API __declspec(dllimport)
13#else
14#define BFCODEC_API
15#endif
16#else
17#if defined(BFCODEC_EXPORTS) || defined(bfcodec_EXPORTS)
18#define BFCODEC_API __attribute__((visibility("default")))
19#else
20#define BFCODEC_API
21#endif
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29struct C_BLOWFISH;
30typedef struct C_BLOWFISH C_BLOWFISH;
31
36BFCODEC_API C_BLOWFISH *bfcodec_init(void);
37
44BFCODEC_API void bfcodec_expand_key(C_BLOWFISH *blf, const uint8_t *key, size_t key_len);
45
53BFCODEC_API void bfcodec_decrypt(C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8]);
54
62BFCODEC_API void bfcodec_encrypt(C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8]);
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* BFCODEC_H */
BFCODEC_API void bfcodec_encrypt(C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8])
Encrypt data in place using CBC with the given 8-byte IV.
Definition bfcodec.c:168
BFCODEC_API C_BLOWFISH * bfcodec_init(void)
Allocate and initialise a Blowfish codec with pi-derived P and S boxes.
Definition bfcodec.c:91
BFCODEC_API void bfcodec_expand_key(C_BLOWFISH *blf, const uint8_t *key, size_t key_len)
Expand key into the codec state (XOR P with key bytes, then expand via encrypt).
Definition bfcodec.c:117
BFCODEC_API void bfcodec_decrypt(C_BLOWFISH *blf, uint8_t *data, size_t len, const uint8_t iv[8])
Decrypt data in place using CBC with the given 8-byte IV.
Definition bfcodec.c:149
Definition bfcodec.c:7