[fix] debug prints have to go to stderr
This commit is contained in:
+6
-6
@@ -35,7 +35,7 @@ pub fn encrypt<S: AsRef<str>>(
|
||||
ReadInfo::NormalChunk(n) => {
|
||||
assert_eq!(n, BUFSIZE);
|
||||
assert_eq!(buf.len(), BUFSIZE);
|
||||
println!("[encrypt]: read normal chunk");
|
||||
eprintln!("[encrypt]: read normal chunk");
|
||||
stream_encryptor.encrypt_next_in_place(&[], &mut buf)?;
|
||||
f_encrypted.write_all(&buf)?;
|
||||
// buf grows after encrypt_next_in_place because of tag that is added
|
||||
@@ -43,14 +43,14 @@ pub fn encrypt<S: AsRef<str>>(
|
||||
buf.truncate(BUFSIZE);
|
||||
}
|
||||
ReadInfo::LastChunk(n) => {
|
||||
println!("[encrypt]: read last chunk");
|
||||
eprintln!("[encrypt]: read last chunk");
|
||||
buf.truncate(n);
|
||||
stream_encryptor.encrypt_last_in_place(&[], &mut buf)?;
|
||||
f_encrypted.write_all(&buf)?;
|
||||
break;
|
||||
}
|
||||
ReadInfo::EmptyChunk => {
|
||||
println!("[encrypt]: read empty chunk");
|
||||
eprintln!("[encrypt]: read empty chunk");
|
||||
panic!("[ERROR] Empty Chunk while reading");
|
||||
}
|
||||
}
|
||||
@@ -81,20 +81,20 @@ pub fn decrypt<S: AsRef<str>>(
|
||||
match read_result {
|
||||
ReadInfo::NormalChunk(n) => {
|
||||
assert_eq!(n, BUFSIZE + 16);
|
||||
println!("[decrypt]: read normal chunk");
|
||||
eprintln!("[decrypt]: read normal chunk");
|
||||
stream_decryptor.decrypt_next_in_place(&[], &mut buf)?;
|
||||
f_plain.write_all(&buf)?;
|
||||
buf.resize(BUFSIZE + 16, 0);
|
||||
}
|
||||
ReadInfo::LastChunk(n) => {
|
||||
println!("[decrypt]: read last chunk");
|
||||
eprintln!("[decrypt]: read last chunk");
|
||||
buf.truncate(n);
|
||||
stream_decryptor.decrypt_last_in_place(&[], &mut buf)?;
|
||||
f_plain.write_all(&buf)?;
|
||||
break;
|
||||
}
|
||||
ReadInfo::EmptyChunk => {
|
||||
println!("[decrypt]: read empty chunk");
|
||||
eprintln!("[decrypt]: read empty chunk");
|
||||
panic!("Empty Chunk while reading");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user