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
use rand;use crypto::aessafe::AesSafe128Encryptor;use crypto::symmetriccipher::BlockEncryptor;fnencrypt(key:&[u8],input:&[u8],output:&mut[u8]){let encryptor = AesSafe128Encryptor::new(key);
encryptor.encrypt_block(input, output);}fnmain(){letmut key = [0u8;128 / 8];for v in key.iter_mut(){*v = rand::random();}letmut output = Vec::<u8>::new();encrypt(&key,"hello".as_bytes(),&mut output);}
Output:
user@user:~/Projects/rust/encrypt-file$ cargo run Compiling encrypt-file v0.1.0 (/home/user/Projects/rust/encrypt-file) Finished dev [unoptimized + debuginfo] target(s) in 0.48s Running `target/debug/encrypt-file`thread 'main' panicked at 'assertion failed: dst.len() * 4 == input.len()', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-crypto-0.2.36/src/cryptoutil.rs:143:5note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
The text was updated successfully, but these errors were encountered:
Dependencies
Output:
The text was updated successfully, but these errors were encountered: