-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update -> finalize #55
base: main
Are you sure you want to change the base?
Conversation
…nstead of eprintln! What is next: `finalize()` should keep track of the state of a block and produce a single block.
finalize()
internally uses cshake
and handles errors with Err() i…finalize()
internally uses cshake
and handles errors with Err() inestead of eprintln!. Also pulled from the main branch.
src/ops.rs
Outdated
/// passes self.data and returns the result | ||
fn finalize(self) -> Result<Vec<u8>, OperationError> { | ||
if let Some(d) = self.d { | ||
let value = d as u64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im imagining how we are going to use this in the sliding window, so I think what we want to do now that we have this framework is to make the following changes:
-
finalize
should accept a single parameter calledoutput_length: u64
- get rid of
value
here and pass inoutput_length
to cshake instead, this way we can control the blocksize output - set
self.msg
= the result of cshake here, and then return self.msg
2 things are happening here:
- this allows us to use the output of this hasher as a block of keystream that we can encrypt or decrypt into the message
- we can effectively control the size of the output block to encrypt a message of any size
actually 3 things
- this keeps rehashing the previous result of cshake so that the keystream doesnt repeat but continuously pumps out new pseudorandom output. if we just keep hashing
self.msg
and returning the hash separately over and over again, we will keep getting the same output repeated which we def do not want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
finalize()
internally uses cshake
and handles errors with Err() inestead of eprintln!. Also pulled from the main branch.
What is next:
finalize()
should keep track of the state of a block and produce a single block.Add features before working on issue #20.