diff --git a/src/secure.rs b/src/secure.rs index d244a1a..7aab1b3 100644 --- a/src/secure.rs +++ b/src/secure.rs @@ -1,5 +1,6 @@ // Libraries use ring::rand::{SecureRandom, SystemRandom}; +use base64::prelude::*; // Constants @@ -23,11 +24,11 @@ impl Secure { ciphertext[i] = value_bytes[i] ^ key_bytes[i % key_bytes.len()]; } - return base64::encode(ciphertext); + return BASE64_STANDARD.encode(ciphertext); } // Takes in cyphertext and a key to decrypt it pub fn decrypt(cyphertext: String, key: String) -> String { - let cyphertext_bytes = base64::decode(cyphertext).expect("(0) Decryption Failed"); + let cyphertext_bytes = BASE64_STANDARD.decode(cyphertext).expect("(0) Decryption Failed"); let key_bytes = key.as_bytes(); let mut plaintext = vec![0u8; cyphertext_bytes.len()];