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

include SHA512 for output files #752

Merged
merged 4 commits into from
Oct 3, 2023
Merged

Conversation

artoonie
Copy link
Collaborator

@artoonie artoonie commented Sep 18, 2023

  1. Every file that's written should now use AuditableFile, instead of File. When the file writing is complete, you should call finalizeAndHash on it. That will mark it as read-only and add its hash to the audit log.
  2. An exception is made for files in the Logger to avoid a circular dependency: how can you write your own hash to your file contents? In this case, we add the hash to the filename.

Alternatively, you could:

String hash;
do {
   hash = getHash(logFilePath);
   ReplaceLastLineOfFileWith("The hash of this file is %s".formatted(hash));
} while (getHash(logFilePath) != lastSeenHash)

But that will take around 10^60 years to complete by my math.

Resolves #746

Copy link
Contributor

@tarheel tarheel left a comment

Choose a reason for hiding this comment

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

But that will take around 10^60 years to complete by my math.

We could make an M2 processor a requirement for running the tabulator. I bet it could complete this in more like 10^59 years.

@yezr
Copy link
Collaborator

yezr commented Sep 20, 2023

I added some notes in #746 that will change the implementation of hashes

@artoonie
Copy link
Collaborator Author

Ready for review with new changes: using a .sha file instead of including the hash in the filename

src/main/java/network/brightspots/rcv/Logger.java Outdated Show resolved Hide resolved
src/main/java/network/brightspots/rcv/Utils.java Outdated Show resolved Hide resolved
@artoonie
Copy link
Collaborator Author

  1. PR comments fixed
  2. Changed .sha files to .hash and included hash algo in file body
  3. Changed signing algo from sha256 to 512

Final review I think! @tarheel

@artoonie artoonie merged commit adfe163 into develop Oct 3, 2023
1 check passed
@artoonie artoonie deleted the feature/hash-for-output-files branch October 3, 2023 16:31
artoonie added a commit that referenced this pull request Oct 3, 2023
artoonie added a commit that referenced this pull request Oct 10, 2023
@yezr yezr changed the title include SHA256 for output files include SHA512 for output files Dec 12, 2023
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.

Generate hash for output files
3 participants