MCPcopy Create free account
hub / github.com/android10/Rust-Cross-Platform-Development / decrypt

Function decrypt

rust-library/cryptor/src/lib.rs:26–35  ·  view source on GitHub ↗

Decrypts a String. Example: ``` use cryptor::decrypt; assert_eq!(decrypt("aGVsbG8="), "hello"); assert_eq!(decrypt(""), ""); ```

(from: &str)

Source from the content-addressed store, hash-verified

24/// assert_eq!(decrypt(""), "");
25/// ```
26pub fn decrypt(from: &str) -> String {
27 let base64_bytes = base64Engine.decode(
28 String::from(from)
29 ).unwrap_or(vec![]);
30
31 match String::from_utf8(base64_bytes) {
32 Ok(result) => result,
33 Err(_) => "".to_owned()
34 }
35}

Callers 3

test_decrypt_stringFunction · 0.50

Calls

no outgoing calls

Tested by 3

test_decrypt_stringFunction · 0.40