Crates.io | yali |
lib.rs | yali |
version | 0.1.1 |
source | src |
created_at | 2024-07-01 17:22:35.221006 |
updated_at | 2024-07-12 21:58:05.884222 |
description | Yet Another LargeInt Library |
homepage | https://github.com/vanten-s/yali |
repository | https://github.com/vanten-s/yali |
max_upload_size | |
id | 1288897 |
size | 55,825 |
Yali is a library for representing, and doing arithmetic with, large numbers.
Parse hex value from string:
use yali::Number;
let num_hex = "ab32fa1689fbc2c2631d4343bad3ab2155d";
let num: Number<16> = num_hex.parse().unwrap();
Regular exponentiation
use yali::Number;
let a = Number::<16>::from(2u64);
let b = Number::<16>::from(4u64);
let c = a ^ b;
assert_eq!(c, Number::<16>::from(16u64));
Modular exponentiation
use yali::Number;
let a: Number<16> = "ab32fa1689fbc2c2631d4343bad3ab2155d".parse().unwrap();
let b: Number<16> = "10001".parse().unwrap();
let n: Number<16> = "4343bad3ab2155d89fbc28c2631d".parse().unwrap();
let num = a.mod_exponentiation(b, n);