happy-cracking 0.5.0

A fast, comprehensive CTF toolkit for cryptographic encoding/decoding, classic ciphers, hash operations, and analysis tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use happy_cracking::crypto::rsa::big_modpow;
use num_bigint::BigUint;
use num_traits::Zero;

#[test]
fn test_modpow_zero_modulus_error() {
    let base = BigUint::from(2u32);
    let exp = BigUint::from(10u32);
    let modulus = BigUint::zero();

    let result = big_modpow(&base, &exp, &modulus);
    assert!(result.is_err());
    assert_eq!(result.unwrap_err().to_string(), "Modulus must be non-zero");
}