go-http-auth
go-http-auth copied to clipboard
Implement SHA-256 and SHA-512 hashed passwords
Fix #72
This reimplements sha256/sha512 algorithm, which is available in the standard library (crypto/sha256 and crypto/sha512 respectively). I'm not sure I understand why this path was chosen instead of using the standard implementations?
Actually it's usage of standard library for sha* hashing, as far as I am aware. Couldn't find sha-crypt with it's 21 steps in my sdk. To be honest I couldn't even find sha-crypt compatible base64 encoding in standard lib. I'd be happy to get a hint, where to look for it.
Nevermind, please hold back this PR. I'll rearrange code. Just noticed "MD5Crypt" in md5crypt.go and will try to move implementation into a separate file and in a similar simplicity.
Here I am - again. I've moved implementation, so "basic.go" is kept slim.
Open to suggestions for improvement - and open for pointers to SHA crypt implementation in standard library. :)
OK, I guess I'm done. Sorry for not submitting one commit at one time. But I wanted to not miss the chance for general feedback, before tweaking the code.
Would be happy to hear about chances, this PR being merged - or reasons it can't.
@abbot newer Shelly devices require SHA256 according to RFC7617: https://shelly-api-docs.shelly.cloud/gen2/Overview/CommonDeviceTraits/#authentication
Is there any chance to look at the open PRs and see what can be merged?
Thanks for additional context. I have some reservations about adding crypto code directly into this package, so instead I started work on moving crypto-related code to x/crypto (in fact there was an open proposal https://github.com/golang/go/issues/14274 about that).