2
CBT Format
riomoo edited this page 2026-02-04 01:59:57 -05:00
CBT File Format
Overview
CBT (Comic Book TAR) is a comic book archive format that uses TAR (Tape Archive) as the container format instead of ZIP. Gopherbook supports both unencrypted and AES-256 encrypted CBT files.
Format Specification
Basic Structure
A CBT file is simply a TAR archive containing:
- Image files (JPEG, PNG, GIF, AVIF, JXL, WebP, BMP, JP2)
ComicInfo.xml(optional metadata)
File Extensions
.cbt- Standard CBT file
Supported Image Formats
.jpg,.jpeg- JPEG images.png- PNG images.gif- GIF images.avif- AVIF images.jxl- JPEG XL images.webp- WebP images.bmp- Bitmap images.jp2- JPEG 2000 images
Encryption
Encryption Method
Gopherbook uses AES-256-CFB (Cipher Feedback mode) for encryption:
- Key Derivation: SHA-256 hash of the password
- IV Generation: Random 16-byte initialization vector
- Encryption: AES-256-CFB on the entire TAR archive
- Storage: IV prepended to ciphertext
Encrypted File Structure
[16 bytes IV][Encrypted TAR data...]
Compatibility
The encryption format is compatible with:
- OpenSSL command-line tools
- Gopherbook's Go implementation
- The provided bash script (
cbt.sh)
ComicInfo.xml
CBT files can include a ComicInfo.xml file for metadata. Gopherbook extracts:
- Title - Comic title
- Series - Series name
- Number - Issue number
- Writer - Writer name
- Artist / Inker - Artist name
- Publisher - Publisher name
- Genre / Tags - Tags/genres
- StoryArc - Story arc name
- Year - Publication year
- Month - Publication month
- Summary - Description
- PageCount - Number of pages
Example ComicInfo.xml
<?xml version="1.0" encoding="utf-8"?>
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Title>The Amazing Adventure</Title>
<Series>Super Comics</Series>
<Number>42</Number>
<Writer>John Doe</Writer>
<Artist>Jane Smith</Artist>
<Publisher>Comic Press</Publisher>
<Genre>Action, Adventure</Genre>
<Tags>superhero, action</Tags>
<StoryArc>The Grand Quest</StoryArc>
<Year>2024</Year>
<Month>1</Month>
<Summary>An epic tale of heroism...</Summary>
<PageCount>24</PageCount>
</ComicInfo>
CBT vs CBZ
Advantages of CBT
- Simpler Format: TAR is simpler than ZIP
- Better for Streaming: Sequential structure
- Unix-Friendly: Native TAR tools on all Unix systems
- Compression Agnostic: Images already compressed
Advantages of CBZ
- More Common: Wider software support
- Per-File Compression: Can compress text metadata
- Random Access: Easier to extract single files
When to Use CBT
- Unix/Linux environments
- Streaming applications
- Encrypted archives (simpler encryption)
- Archival purposes
When to Use CBZ
- Windows environments
- Maximum compatibility
- Need per-file compression
- Most comic readers
Creating CBT Files
See the Creating CBT Files page for detailed instructions using:
- The
cbt.shbash script - The
cbt.goGo program - Manual TAR commands
Technical Details
Encryption Algorithm Details
Algorithm: AES-256-CFB
Key: SHA256(password) = 32 bytes
IV: Random 16 bytes
Block Size: 16 bytes (128 bits)
Mode: CFB (Cipher Feedback)
Decryption Process
- Read first 16 bytes as IV
- Read remaining bytes as ciphertext
- Derive key from password using SHA-256
- Decrypt using AES-256-CFB with IV and key
- Extract TAR archive from plaintext
Validation
To check if a CBT is encrypted:
# Try reading as TAR
tar -tf file.cbt
# If it fails, likely encrypted
# If it succeeds, unencrypted
File Organization
Gopherbook automatically organizes CBT files:
library/
└── [Artist]/
└── [StoryArc]/
└── comic.cbt
Based on extracted metadata from ComicInfo.xml.
Best Practices
- Always include ComicInfo.xml for proper metadata
- Use consistent naming for images (001.jpg, 002.jpg, etc.)
- Encrypt sensitive content using strong passwords
- Store passwords securely (Gopherbook does this automatically)
- Backup your library regularly
Related Pages
Note: CBT support is a unique feature of Gopherbook. Most comic readers only support CBZ/CBR formats.