libhardcopy
Current Release: 1.0.1
Core library for hardcopy/softcopy encoding. Provides plugins for encoding binary data into printable formats (mnemonics, QR codes) and decoding them back.
Features
- Plugin architecture: Extensible encoding/decoding plugins
- Multiple output formats: Word lists, QR codes (PNG bytes)
- Round-trip encoding: Generate hard copy, recover soft copy, validate integrity
- Checksums: Built-in SHA-256 verification
Plugins
| Feature | Plugin | Encoding | Words/Line | Description |
|---|---|---|---|---|
out-qrcode |
qrcode |
Binary → QR PNG | N/A | QR codes (500 bytes/code) |
out-bip39 |
bip39 |
Binary → BIP-39 words | 6 | 2048-word mnemonic list |
out-diceware |
diceware |
Binary → EFF Diceware | 6 | 7776-word EFF list (12 bits/word) |
| — | pgpfone |
Binary → PGPfone words | 4 | Phonetically distinct words |
| — | skeyotp |
Binary → S/KEY OTP words | 6 | RFC 2289 one-time passwords |
Default features: none. Enable with Cargo features.
Data Structures
use ;
// Input: binary data to encode
let input = from_bytes;
// Generate hard copy using a plugin
let plugin = PGPfonePlugin;
let hardcopy = plugin.generate_hard_copy?;
// Render sections (words or QR PNG bytes)
for section in &hardcopy.sections
// Recover soft copy from user-entered words
let mut user_input = new;
user_input.push_line;
let softcopy = plugin.generate_soft_copy?;
let recovered_bytes = softcopy.bytes;
Plugin Traits
Cargo Features
[]
= { = "1.0.0", = ["out-qrcode", "out-bip39", "out-diceware"] }
[]
= ["qrcode", "image"]
= ["wordlists/bip-39"]
= ["wordlists/diceware-eff-large"]
Usage in hardcopy/softcopy CLI
This library powers the hardcopy (encode) and softcopy (decode) binaries in this workspace.
hardcopy— reads stdin/files, encodes via plugins, outputs PDF/TXT/HTMLsoftcopy— interactive decode from word lists, validates checksums
License
GPL-3.0