Skip to content

Reject rounds=0 for SHA1 hashes #326

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

Merged
merged 2 commits into from
Nov 5, 2019
Merged

Reject rounds=0 for SHA1 hashes #326

merged 2 commits into from
Nov 5, 2019

Conversation

rsgowman
Copy link
Member

@rsgowman rsgowman commented Nov 1, 2019

@rsgowman rsgowman self-assigned this Nov 1, 2019
@@ -145,6 +146,91 @@ public void testBasicHash() {
}
}

private void assertBuilderThrowsIllegalArgumentException(Md5.Builder builder) {
Copy link
Member Author

Choose a reason for hiding this comment

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

An alternative to these helpers is to make all of the builders extend from a common interface (which they do: RepeatableHash.Builder) and make it public (which it isn't; and neither is RepeatableHash) even if it's just @VisibleForTesting. I didn't do that, in the (naively?) optimistic hope that we'll update to java8 "soon" which will make all that unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

May be move this to InvalidHashTest. There RepeatableHash is already visible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, yeah; that's definitely better. (Despite the name, I also used this file to test for valid hashes too.)

@rsgowman rsgowman requested a review from hiranya911 November 1, 2019 19:51
@rsgowman rsgowman assigned hiranya911 and unassigned rsgowman Nov 1, 2019
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

Looks pretty good. Just a couple of suggestions.

@@ -145,6 +146,91 @@ public void testBasicHash() {
}
}

private void assertBuilderThrowsIllegalArgumentException(Md5.Builder builder) {
Copy link
Contributor

Choose a reason for hiding this comment

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

May be move this to InvalidHashTest. There RepeatableHash is already visible.

@hiranya911 hiranya911 assigned rsgowman and unassigned hiranya911 Nov 1, 2019
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM 👍

@rsgowman rsgowman merged commit b7b7125 into master Nov 5, 2019
@rsgowman rsgowman deleted the rsgowman/rounds0 branch November 5, 2019 18:38
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