You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the below example, can you show how to use other algorithms usage as simple example. thanks
fnmain(){let message = "Hello World!";letmut key:[u8;32] = [0;32];letmut iv:[u8;16] = [0;16];// In a real program, the key and iv may be determined// using some other mechanism. If a password is to be used// as a key, an algorithm like PBKDF2, Bcrypt, or Scrypt (all// supported by Rust-Crypto!) would be a good choice to derive// a password. For the purposes of this example, the key and// iv are just random values.letmut rng = OsRng::new().ok().unwrap();
rng.fill_bytes(&mut key);
rng.fill_bytes(&mut iv);let encrypted_data = encrypt(message.as_bytes(),&key,&iv).ok().unwrap();let decrypted_data = decrypt(&encrypted_data[..],&key,&iv).ok().unwrap();assert!(message.as_bytes() == &decrypted_data[..]);}
The text was updated successfully, but these errors were encountered:
I read the below example, can you show how to use other algorithms usage as simple example. thanks
The text was updated successfully, but these errors were encountered: