A Go library and CLI tool for classical cryptography and cryptanalysis. Provides implementations of historical ciphers with file processing and concurrent operations.
Library: Core cipher implementations and cryptanalysis algorithms for use in Go projects.
CLI: arcipher command-line tool for encrypting, decrypting, and analyzing text and files with support for concurrent block processing.
| Cipher Name | Cipher Type | Variant |
|---|---|---|
| Rail Fence | Permutation | — |
| Caesar | Substitution | — |
| Cardan | Hole Permutation | — |
| Vigenere | Polyalphabetic Substitution | Autokey (-a) |
| Affine | Polygraphic Substituion | Hill |
| Analyzer Name | Ciphers |
|---|---|
| Frequency Analysis | Caesar |
| Kasiski Test & Frequency Analysis | Vigenere |
| Padding Scheme |
|---|
| ISOIEC7816 |
Matrix operations and modular arithmetic utilities for classical cipher implementations.
- Go 1.25.5 or later
go get github.com/ItakawaM/arciphermacOS / Linux:
go build -o arcipher ./cmd/arcipheror
make build BINARY=arcipherWindows:
go build -o arcipher.exe ./cmd/arcipheror
make buildpackage main
import "github.com/ItakawaM/arcipher/ciphers"
func main() {
// Create a new cipher
cipher, err := ciphers.NewCaesarCipher(12)
if err != nil {
// Process error
}
// Create source and destination buffers
src := []byte("HelloWorld")
dst := make([]byte, len(src))
// Perform action
if err := cipher.EncryptBlock(dst, src); err != nil {
// Process error
}
// Alternatively, you can alias buffers if the desired cipher allows it
if cipher.IsInPlace() {
if err := cipher.EncryptBlock(src, src); err != nil {
// Process error
}
}
}Basic pattern:
arcipher <CIPHER> <ACTION> <ARGS> [FLAGS]Getting help:
arcipher <COMMAND> --helpVerbose output:
arcipher <COMMAND> --verbosearcipher railfence encrypt 3 "helloworld"
arcipher railfence decrypt 3 "loelwrdhol"arcipher railfence encrypt 10 ./example/SunPoem ./example/SunPoem.enc --block 1024 --threads 4 -v
arcipher railfence decrypt 10 ./example/SunPoem.enc ./example/SunPoem --block 1024 --threads 4 -varcipher caesar encrypt 15 "helloworld"
arcipher caesar decrypt 15 "wtaadldgas"arcipher caesar bruteforce "wtaadldgas"
arcipher caesar analyze "wtaadldgas"arcipher caesar encrypt 5 ./example/SunPoem ./example/SunPoem.enc --block 256 --threads 2
arcipher caesar decrypt 5 ./example/SunPoem.enc ./example/SunPoem --block 256 --threads 2arcipher caesar bruteforce ./example/SunPoem /example/SunPoem_Directory -t 6 -b 2048
arcipher caesar analyze ./example/SunPoemarcipher cardan encrypt "helloworld" --export key.json
arcipher cardan decrypt "h lowd e ol lr "arcipher cardan encrypt ./key.json "helloworld"
arcipher cardan decrypt ./key.json "h lowd e ol lr "arcipher cardan generate-key 5 key.jsonarcipher cardan encrypt key.json ./example/SunPoem ./example/SunPoem.enc --threads 4 -v
arcipher cardan decrypt key.json ./example/SunPoem.enc ./example/SunPoem --threads 4 -varcipher vigenere encrypt "Secret" "helloworld"
arcipher vigenere decrypt "Secret" "zincspgvnu"arcipher vigenere bruteforce ./example/dict.txt "zincspgvnu"
arcipher vigenere analyze "zincspgvnu"arcipher vigenere encrypt "Keyword" ./example/SunPoem ./example/SunPoem.enc --block 512 --threads 4
arcipher vigenere decrypt "Keyword" ./example/SunPoem.enc ./example/SunPoem --block 512 --threads 4arcipher vigenere bruteforce ./example/dict.txt ./example/SunPoem /example/SunPoem_Directory --threads 4
arcipher vigenere analyze ./example/SunPoem.encarcipher vigenere encrypt "Secret" "helloworld" -a
arcipher vigenere decrypt "Secret" "zincspvvwo" -aarcipher vigenere encrypt "Keyword" ./example/SunPoem ./example/SunPoem.enc --block 512 --threads 4 -a
arcipher vigenere decrypt "Keyword" ./example/SunPoem.enc ./example/SunPoem --block 512 --threads 4 -aarcipher affine generate-key 3 key.json
arcipher affine generate-key 25 key.json --templatearcipher affine encrypt ./key.json "HELLOWORLD"
arcipher affine decrypt ./key.json "ZICVTWQNGRZGVTWAVZHCQYGLMGJ"arcipher affine encrypt key.json ./example/input ./example/input.enc --threads 4 -v
arcipher affine decrypt key.json ./example/input.enc ./example/output --threads 4 -v-v, --verbose— Show performance metrics-b, --block— Block size in KB for file processing (default: 64)-t, --threads— Worker threads for file processing (default: CPU cores / 2)
go test ./tests/...or
make testMIT License — see LICENSE
