Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: update -> finalize #55

wants to merge 6 commits into from

Conversation

Hyunggilwoo
Copy link
Collaborator

@Hyunggilwoo Hyunggilwoo commented Mar 4, 2024

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.

…nstead of eprintln!

What is next:
`finalize()` should keep track of the state of a block and produce a single block.
@Hyunggilwoo Hyunggilwoo changed the title 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. Mar 4, 2024
src/ops.rs Outdated Show resolved Hide resolved
src/ops.rs Outdated Show resolved Hide resolved
@Hyunggilwoo Hyunggilwoo requested a review from Dustin-Ray March 5, 2024 00:59
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;
Copy link
Owner

@Dustin-Ray Dustin-Ray Mar 5, 2024

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 called output_length: u64
  • get rid of value here and pass in output_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:

  1. this allows us to use the output of this hasher as a block of keystream that we can encrypt or decrypt into the message
  2. we can effectively control the size of the output block to encrypt a message of any size

actually 3 things

  1. 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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@Dustin-Ray Dustin-Ray changed the title finalize() internally uses cshake and handles errors with Err() inestead of eprintln!. Also pulled from the main branch. feat: update -> finalize Mar 6, 2024
@Hyunggilwoo Hyunggilwoo mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants