

Tools and a C/C++ library to manipulate BFCodec-encrypted content.
How to use
jbt
jbt encrypts a directory of game data then zips it up. The extension depends on the target game. You must use the correct key to encrypt the data.
jbt -K 'the game key' game-data/ game-data.jbt
unjbt
Like unzip, unjbt extracts the zip file then decrypts each game file. Conversions will happen if tools are in PATH:
| Input Format | Output Format | Tool Used |
| Binary Property List (plist) | XML Property List | libplist (if found at configure time), CoreFoundation (macOS) |
| CgBI PNG | PNG | pngcrush, pngdefry |
pngdefry can be downloaded from its official site (archived). pngcrush is only available on macOS if you have Xcode installed.
unjbt -d game-data game-data.jbt
If the directory passed to -d/--extract-to does not exist it will be created.
C interface
void func() {
const uint8_t my_key = {};
const uint8_t iv[8] = {};
}
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
Link with -lbfcodec.
C++ interface
++
void func() {
bfc.expandKey({ });
bfc.decrypt(inOutData, {});
bfc.encrypt(inOutData, {})
}
static std::expected< BFCodec, BFCodecError > create()
Create a codec instance (calls bfcodec_init()).
Definition bfcodec.cc:24
Link with -lbfcodec.
Building from source
Requirements:
- CMake
- On Linux (for tools): OpenSSL
- Optional: libplist on non-macOS
Basic commands to build after cloning:
mkdir build
cd build
cmake ..
make
jbt and unjbt will be in the tools directory.