You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charles Reid
4579b198b0
|
8 years ago | |
---|---|---|
affine | 8 years ago | |
caesar | 8 years ago | |
enigma | 8 years ago | |
mod | 8 years ago | |
moscow | 8 years ago | |
primes | 8 years ago | |
puzzles | 8 years ago | |
.gitignore | 8 years ago | |
LICENSE | 8 years ago | |
README.md | 8 years ago |
README.md
java-crypto
Code for doing cryptography in Java.
Crypto Math Classes
Crypto Math: Modular Arithmetic
The Modular Arithmetic class is a static class with methods useful in doing modular arithmetic. These include finding gcds, factoring modulo a number, computing exponents, finding inverses, etc.
- gcd(a,b)
- extendedEuclidian(xy[], a, b)
- solve(a,c,n)
- inverseMod(a,n)
Cipher Implementations:
Cipher Implementation: Caesar Cipher
The Caesar class implements the Caesar cipher, which is a simple rotation (ROT) cipher with a key between 0 and 25.
Cipher Implementation: Affine Cipher
The Affine class implements the Affine cipher, which implements both a multiplicative and an additive shift. The key has two parts.
If the letters are indexed from 0 to 25, they are shifted according to the formula: formula:
a x + b (mod 26)
where a is the first part of the key and b is the second part of the key. This requires that gcd(a,26) = 1.