Decrypts a String. Example: ``` use cryptor::decrypt; assert_eq!(decrypt("aGVsbG8="), "hello"); assert_eq!(decrypt(""), ""); ```
(from: &str)
| 24 | /// assert_eq!(decrypt(""), ""); |
| 25 | /// ``` |
| 26 | pub 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 | } |
no outgoing calls