I repeat: do not use SHA-1 in new applications. Do not use this module.
I repeat: do not use SHA-1 in new applications. Do not use this module.
I bet that as soon as standards bodies (like NIST) actively encourage you to use better hash functions (which they will probably do soon) the developer of this module will decide on what is safe enough for this purpose.
Part of security is being up-to-date in regards to things like hashes. If authors don't update their own libraries and you need to tweak them manually, how is it different from "writing your own"?
I strongly agree with Armin: HMAC-SHA1 (note, the combo, it's not just the latter) is still good security for most applications you'd consider this library for.
https://github.com/mitsuhiko/itsdangerous/blob/59f3bf7877e21...
And the tests, of course.
Probably, but not necessarily. It's not like the other sha versions are fixing the overall problem however.
> Do not use this module.
Even before the 0.13 release I just pushed out where you can override the module easier you could still easily change the hash method with a two line change. Also it's not like maintainers can't change things easily if modules are well defined.
And even if the module would not allow changing the hash method easily SHA1 with HMAC is still incredibly hard to exploit.
You would indeed be better off using SHA256.
But not much. It's worth pointing out though that dogmatism around not using SHA-1 is misplaced. There are still no practical attacks on HMAC-MD5, for instance, even though MD5 itself is effectively broken and its use in (for instance) X.509 certificates is insecure.
As it is, the size of that digest is also 14 bytes more and I don't feel happy truncating the hash. The bigger SHA2 versions are even longer. Considering that thing should go into cookies and URLs I did not feel very happy with that.
> You would indeed be better off using SHA256.
Probably. I was indeed under the impression that SHA2 is based on the same building blocks as SHA1 but I assume that is not the case. That being said: upgrading is not hard if it even comes to the point where it would be necessary.
Sometime soon I believe SHA-3 will be chosen and we'll all be able to move onto that.
"NIST also plans to host a final SHA-3 Candidate Conference in the spring of 2012 to discuss the public feedback on these candidates, and select the SHA-3 winner later in 2012." [http://csrc.nist.gov/groups/ST/hash/sha-3/Round3/index.html]
The final SHA-3 Candidate Conference was held March 22-23, so they should be picking the winner any day now.
That is not necessary, I adjusted the API so that you can easily subclass it and change the digestmod.