Closed netson closed 10 months ago
Implementation of those functions is simple enough and your use case looks like a bit too niche, so I think a better solution will be for you to write custom functions in your project based on the sha*_crypt_b64
functions.
Thanks for the feedback; it is simple enough to implement I just was hoping to avoid duplicating code which already exists in the crate. The use-case by the way is for configuration management tools for which I do not wish to generate a new has on each config run, which would indicate a change but isn't really a change.
I will make it work for my use-case, thanks!
Hi! First of all, thanks for this awesome set of crates! :-)
For a small project I am working on, I need to generate some SHA-512 Crypt hashes and am using the sha512_simple function to do so. In order to be able to consistently generate the same hash for the same password, I wanted to provide a salt myself, for which I can use the sha512_crypt() function, but the problem is that that function does not let me format the resulting hash (starting $6$ etc). Most of the constants and functions needed to do so are private.
Instead of making them public, would you be open to a PR which allows an optional 3rd argument to the sha512_simple and sha256_simple functions which takes a predefined salt, either as bytes or as a &str? Although adding a 3rd argument would probably introduce breaking changes for existing code, so maybe it should be 2 new functions, i.e. sha512_simple_with_salt() or something?
I'd be happy to take a stab at a PR but wanted to know if that would be appreciated first.