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

Adjusting for base64 1.0 #74

Merged
merged 7 commits into from
Jan 28, 2024
Merged

Adjusting for base64 1.0 #74

merged 7 commits into from
Jan 28, 2024

Conversation

Vlix
Copy link
Collaborator

@Vlix Vlix commented Jan 25, 2024

Took the opportunity to also add a flag to build with crypton.

Bumped GHC version testing to 9.8.1 and dropped 8.8.4.

Bumped LTS to 22.7 to build with GHC 9.6.4 normally.

@@ -56,6 +56,11 @@ flag bcrypt
default: True
manual: True

flag crypton
description: Compile with Scrypt support?
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
description: Compile with Scrypt support?
description: Use the crypton library as the cryptographic backend

Feel free to reword this

description: Compile with Scrypt support?
default: False
manual: True

Copy link
Owner

Choose a reason for hiding this comment

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

I thought it might be nice to go ahead and add the cryptonite flag in right now, in case there are users that want to set this in advance of the switch.

Suggested change
flag cryptonite
description: Use the cryptonite library as the cryptographic backend
default: True
manual: True

Also, I guess we should have some sort of assertion that exactly one of the crypton / cryptonite flags is set. I'm not sure how to do this off the top of my head though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I feel it's a good idea to include the flag, but I'd argue to add to the cryptonite flag description: "... (does nothing until crypton becomes the default)"

And then when we switch in a major version, that part is removed and the crypton flag description turns into "This flag is here for backwards compatibility"

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, that sounds good!

Comment on lines -250 to +267
guard $ length paramList == 4
let [ algT,
iterationsT,
salt64,
hashedKey64 ] = paramList
pbkdf2Algorithm <- textToAlg algT
pbkdf2Iterations <- readT iterationsT
salt <- from64 salt64
hashedKey <- from64 hashedKey64
let pbkdf2OutputLength = fromIntegral $ C8.length hashedKey
pbkdf2Salt = fromIntegral $ C8.length salt
return (PBKDF2Params{..}, Salt salt, hashedKey)
case paramList of
[algT, iterationsT, salt64, hashedKey64] -> do
pbkdf2Algorithm <- textToAlg algT
pbkdf2Iterations <- readT iterationsT
salt <- from64 salt64
hashedKey <- from64 hashedKey64
let pbkdf2OutputLength = fromIntegral $ C8.length hashedKey
pbkdf2Salt = fromIntegral $ C8.length salt
return (PBKDF2Params{..}, Salt salt, hashedKey)
_ -> Nothing
Copy link
Owner

Choose a reason for hiding this comment

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

Nice rewrite :-)

@Vlix
Copy link
Collaborator Author

Vlix commented Jan 27, 2024

Looks good? @cdepillabout

Copy link
Owner

@cdepillabout cdepillabout left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@Vlix
Copy link
Collaborator Author

Vlix commented Jan 28, 2024

I'll merge tomorrow and push to hackage.

@Vlix Vlix merged commit 29e2f3a into master Jan 28, 2024
18 checks passed
@Vlix Vlix deleted the adjusting-for-base64-1.0 branch January 28, 2024 19:47
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.

None yet

2 participants