use-modular
Install
[]
= "0.0.5"
What belongs here
use-modular owns small modular arithmetic operations over primitive signed
integers. It keeps normalization, addition, subtraction, multiplication,
exponentiation, inverses, and congruence checks explicit while always returning
residues normalized to 0..modulus.
Invalid moduli are handled conservatively: functions return None when
modulus <= 0, and congruence checks return false.
Neighboring crates
| Crate | Responsibility |
|---|---|
use-modular |
Modular arithmetic operations and congruence checks |
use-integer |
Integer classification and integer-specific descriptive helpers |
use-number |
Broader number abstractions and shared numeric vocabulary |
use-prime |
Primality, sieves, prime generation, and factorization |
use-algebra |
Algebraic structures and law checking over caller-supplied ops |
use-combinatorics |
Counting helpers that may consume modular arithmetic |
use-cryptography |
Future protocol and cryptographic constructions built on modularity |
use-modular intentionally does not define primality testing,
factorization, ring traits, cryptographic protocols, or large arbitrary-
precision integer types.
Examples
Normalize and combine residues
use ;
assert_eq!;
assert_eq!;
assert_eq!;
Exponentiation and inverse
use ;
assert_eq!;
assert_eq!;
Congruence
use is_congruent;
assert!;
assert!;
Status
use-modular is a concrete pre-1.0 crate in the RustUse math workspace. The
API stays explicit and dependency-free so adjacent integer, number, algebra,
combinatorics, and future cryptography crates can share one small modular
arithmetic vocabulary.