Skip to content

Tatsh/bfcodec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfcodec

C++ GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot GitHub Pages Stargazers CMake Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

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

// If using a DLL on Windows:
// #ifdef _WIN32
// #define BFCODEC_USE_DLL 1
// #endif
#include <bfcodec.h>

void func() {
  C_BLOWFISH *blf = bfcodec_init();
  const uint8_t my_key = {};
  const uint8_t iv[8] = {};
  bfcodec_expand_key(blf, &my_key, 16);
  bfcodec_decrypt(blf, in_out_data, data_len, my_iv);
  // or
  bfcodec_encrypt(blf, in_out_data, data_len, my_iv);
}

Link with -lbfcodec.

C++ interface

// If using a DLL on Windows:
// #ifdef _WIN32
// #define BFCODEC_USE_DLL 1
// #endif
#include <bfcodecpp.h>

void func() {
  auto bfc = BFCodec::create();
  bfc.expandKey({ /* key here */});
  bfc.decrypt(inOutData, {/* IV here */});
  // or
  bfc.encrypt(inOutData, {/* IV here */})
}

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.

About

Tools and a C/C++ library to manipulate BFCodec-encrypted content.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors