-
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
Pivotal # 177647985: MD5 Calculation For Big Files #366
Conversation
Switch from full read file for MD5 calculation to a buffered reader approach
|
||
val md5sum = BigInteger(CHECKSUM_SIGNUM, digest.digest()).toString(HEXADECIMAL_BASE) | ||
return String.format("%32s", md5sum).replace(" ", "0") | ||
} |
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.
fun md5(file: File): String {
val digest = MessageDigest.getInstance(MD5_ALGORITHM)
file.inputStream().buffered(BUFFER_SIZE).use { it.iterator().forEach(digest::update) }
return digest.digest().joinToString("") { "%02x".format(it) }
}
Maybe?
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.
Works like a charm! I knew there was a better way to write this. Nice comment 😁👍
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.
Fixed
Code review comments
Feature: * Pivotal ID # 177304040: PT Submit Migration Operation (#362) Bugfix: * Pivotal ID # 177536825: Add handler for SubmissionNotFoundException to response with the correct http status code (#364) * Pivotal # 177647985: MD5 Calculation For Big Files (#366) * Pivotal ID #177756846: Allow to bypass toxic risk validation when QMRF-ID attribute (#370) Chore: * Pivotal ID #177423348: PMC integration test (#356) * Pivotal ID # 177413307: Report Submissions With Errors (#368) Co-authored-by: Juan <jcamilorada@ebi.ac.uk> Co-authored-by: Néstor Diaz <ndiaz@ebi.ac.uk>
Feature: * Pivotal ID # 177304040: PT Submit Migration Operation (#362) Bugfix: * Pivotal ID # 177536825: Add handler for SubmissionNotFoundException to response with the correct http status code (#364) * Pivotal # 177647985: MD5 Calculation For Big Files (#366) * Pivotal ID #177756846: Allow to bypass toxic risk validation when QMRF-ID attribute (#370) Chore: * Pivotal ID #177423348: PMC integration test (#356) * Pivotal ID # 177413307: Report Submissions With Errors (#368) Co-authored-by: Juan <jcamilorada@ebi.ac.uk> Co-authored-by: Néstor Diaz <ndiaz@ebi.ac.uk>
https://www.pivotaltracker.com/story/show/177647985
Switch from full read file for MD5 calculation to a buffered reader approach