Crate pkcrack

Crate pkcrack 

Source
Expand description

§PKCRACK - Rust Implementation

A Rust implementation of the known-plaintext attack against PkZip encryption. This library provides the same functionality as the original C implementation but with modern Rust safety and ergonomics.

§Architecture

The attack is divided into three main stages:

  • Stage 1: Generate and reduce possible key2 values
  • Stage 2: Reconstruct complete key sequences
  • Stage 3: Find password or decrypt ZIP file

§Usage

use pkcrack::{PkCracker, Config};

let config = Config::new("encrypted.zip", "plaintext.txt")
    .with_offset(12);

let mut cracker = PkCracker::new(config)?;
let result = cracker.attack()?;

Re-exports§

pub use config::Config;
pub use config::Cli;
pub use error::Result;
pub use error::PkCrackError;
pub use cracker::PkCracker;
pub use cracker::AttackReport;
pub use types::*;

Modules§

config
Configuration and command line handling for pkcrack
cracker
Main pkcrack attack orchestrator
crc
CRC-32 implementation and precomputed tables
crypto
Cryptographic operations and precomputed tables for the attack
error
Error handling for pkcrack
stage1
Stage 1 of the pkcrack attack: Generate and reduce possible key2 values
stage2
Stage 2 of the pkcrack attack: Reconstruct complete key sequences
stage3
Stage 3 of the pkcrack attack: Password search or ZIP decryption
types
Basic type definitions and data structures for pkcrack
zip
ZIP file processing for pkcrack

Constants§

CONST
GOOD_NUM
INVCONST
KEY2_SPACE
MAX_DELTA
MSB_MASK
VERY_GOOD

Functions§

key3_at
Key3 calculation: key3 = plaintext[i] XOR ciphertext[i]
msb
Most significant byte extraction