bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
237 stars 122 forks source link

Add Argon2 (and a little bit of clean-up) #109

Closed AKushWarrior closed 3 years ago

AKushWarrior commented 3 years ago

I ported the Argon2 implementation that @gmpassos created (at https://github.com/gmpassos/argon2/blob/master/lib/src/argon2_base.dart) over into the PointyCastle KeyDerivator style.

I also tweaked the registry process to be a bit simpler. Before, you'd have to export a class (using the path) from lib/export.dart and also import it (using the path) from lib/src/registry/registration.dart, where you'd also also have to call registry.register in the relevant category. Now, registration.dart just imports export.dart, so you only have to do the first and third step.

I also noticed a few classes were missing from export.dart, so I went ahead and added them. I really think we should have this process documented (create a class, export it, add it to the registry) somewhere, considering the amount of external contributors.

gmpassos commented 3 years ago

Please add a reference to the project that you copied the code:

Ported to Dart by Graciliano M. Passos:
- https://pub.dev/packages/argon2
- https://github.com/gmpassos/argon2

Also keep the original comments (the license part is not needed since it's a reference to the bcgit/bc-java license): https://github.com/gmpassos/argon2/blob/master/lib/src/argon2_base.dart#L10

You can't just remove this, at least make a reference to the authors, we do this for free!

AKushWarrior commented 3 years ago

@gmpassos Sorry, credit was an oversight on my part; I certainly didn't want to strip you of your credit. I generally just followed the same procedure I use when porting BouncyCastle classes when you posted your repository in that issue, and rushed through.

The link for the original BC implementation is largely redundant/unnecessary. This project is run by the BouncyCastle team, and nearly every class is a direct port of classes from the original BouncyCastle project. I did add the password hashing competition / IETF blurb; it's obvious to me (and I think most people in the cryptographic fields), but I suppose that this is a general-purpose library.

I also added your Ported to Dart blurb in the argon2 and argon2 test files, and added you to Contributors.md. Again, my apologies for the earlier oversight.

gmpassos commented 3 years ago

Thanks. Nice job!

AKushWarrior commented 3 years ago

@mwcw Can you take a look at getting this merged? I can add more tests if necessary.

AKushWarrior commented 3 years ago

This was merged to the internal repository. I'm closing the PR.