Function deserialize_and_decrypt Copy item path Source pub fn deserialize_and_decrypt(
password: &[u8 ],
serialized: &[u8 ],
) -> Result <Vec <u8 >, DecryptError >Expand description Assumes that the given bytes is a Bincode serialized Encrypted structure, and first
deserializes it and then tries to decrypt it using the given password bytes
Password cannot be longer than 32 bytes
2 fn main() {
3 let payload = "Hello world!" .as_bytes();
4 let password = b"hello wooooooooo" ;
5
6 println! ("Payload: {:?}" , payload);
7 let encrypted = simplestcrypt::encrypt_and_serialize(& password[..], & payload).unwrap();
8 println! ("Encrypted: {:?}" , encrypted);
9 let plain = simplestcrypt::deserialize_and_decrypt (& password[..], & encrypted).unwrap();
10
11 println! ("Decrypted: {:?}" , & plain);
12 }