MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / vernam_encrypt

Function vernam_encrypt

src/ciphers/vernam.rs:40–72  ·  view source on GitHub ↗

Vernam Cipher The Vernam cipher is a symmetric stream cipher where plaintext is combined with a random or pseudorandom stream of data (the key) of the same length. This implementation uses the alphabet A-Z with modular arithmetic. # Algorithm For encryption: C = (P + K) mod 26 For decryption: P = (C - K) mod 26 Where P is plaintext, K is key, and C is ciphertext (all converted to 0-25 range) E

(plaintext: &str, key: &str)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 7

test_key_wrappingFunction · 0.85
test_empty_key_encryptFunction · 0.85

Calls 2

iterMethod · 0.45
lenMethod · 0.45

Tested by 7

test_key_wrappingFunction · 0.68
test_empty_key_encryptFunction · 0.68