#attack #crypto

fractus

Cryptographic attack library for Rust and Python

7 releases

0.1.11 Sep 18, 2024
0.1.10 Sep 15, 2024
0.1.9 Jun 29, 2024
0.1.8 May 26, 2024
0.1.7 Feb 24, 2024

#408 in Cryptography

Download history 163/week @ 2024-09-11 179/week @ 2024-09-18 32/week @ 2024-09-25 15/week @ 2024-10-02 1/week @ 2024-10-09

397 downloads per month

MIT license

170KB
3.5K SLoC

Fractus

Fractus is a cryptographic attack library written in rust. It is also available through python

Run

Rust

cargo add fractus

use fractus::sha2_256;

let m = b"abc";
let h = sha2_256::compute(&m);
let e = b"cde";
let mut c = m.to_vec();
c.extend(sha2_256::padding(m.len()));
c.extend(e);
let e = sha2_256::extend(&h, m.len(), e);
assert_eq!(e, sha2_256::compute(c));

Python

pip install fractus

from fractus import sha2_256

m = b'secret' + b'abc'
h = sha2_256.compute(m)
e = b'test'
assert sha2_256.extend(h, len(m), e) == sha2_256.compute(m + sha2_256.padding(len(m)) + e)

Features

Length Extension Attack

  • MD4
  • MD5
  • SHA0
  • SHA1
  • SHA2_224
  • SHA2_256
  • SHA2_512
  • Ripemd128
  • Ripemd160
  • Ripemd256
  • Ripemd320
  • Whirlpool

Dependencies

~13–26MB
~346K SLoC