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

Function affine_encrypt

src/ciphers/affine_cipher.rs:160–180  ·  view source on GitHub ↗

Encrypts a message using the affine cipher. # Arguments `key` - The encryption key (encoded as key_a * SYMBOLS.len() + key_b) `message` - The plaintext message to encrypt # Returns `Ok(String)` with the encrypted message, or `Err(String)` if keys are invalid # Example ``` use the_algorithms_rust::ciphers::affine_encrypt; let encrypted = affine_encrypt(4545, "The affine cipher is a type of m

(key: usize, message: &str)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 13

test_encrypt_simpleFunction · 0.85
test_empty_stringFunction · 0.85
test_key_b_too_largeFunction · 0.85
test_symbols_not_in_setFunction · 0.85
test_generate_keyFunction · 0.85
test_all_symbolsFunction · 0.85

Calls 4

check_keysFunction · 0.85
pushMethod · 0.80
lenMethod · 0.45
findMethod · 0.45

Tested by 13

test_encrypt_simpleFunction · 0.68
test_empty_stringFunction · 0.68
test_key_b_too_largeFunction · 0.68
test_symbols_not_in_setFunction · 0.68
test_generate_keyFunction · 0.68
test_all_symbolsFunction · 0.68