-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fix analysis with FIPS mode #137
Conversation
Hm, from what I understand FIPS is a standard that enforces minimal security, and the MD5 hash used by pygount to quickly distinguish files does not comply. Is there any other hashing algorithm in the Python standard library, that has similar performance as MD5 but conforms to FIPS? If so, I believe this would be a better solution. (In the end, the quality of the hashing does not really matter because even if the hashes match, pygount still compares the content. This is much slower, but if it happens rarely enough, there won't be any difference.) |
@MattTheCuber I did a little digging. According to the hashlib documentation, SHA1 complies with FIPS. According to this stackoverflow discussion, MD5 and SHA1 have similar performance. SHA1 tends to be a slower, but on some CPU's is even faster. If you could chage the hashing from MD5 to SHA1, I would happily merge this. |
I'd be fine with changing it. However, the hashing isn't used for security from what I saw? If that is the case, then md5 works perfectly fine with the flag I provided and has identical performance. |
High security, not minimal. Often required on government machines. |
Yes, there is no real security requirement here, but then, nowadays md5 is bashed so much regardless of that, so it should be fun to use SHA1 and proudly claim FIPS compliance. 😉 I also checked if we can enable FIPS for the GitHub CI, but it seems we would need a Pro license for that: https://ubuntu.com/security/certifications/docs/2204/fips
Bad wording from my side, that's what I meant. |
Well, that escalated quickly. Apparently openssl has its own benchmark one can run with
I did just that and on my MacBook Pro M1 it seems SHA256 is actually faster and FISP compliant for the foreseeable future:
So I guess we should switch to that.
Yes, please (with SHA256 resp.). |
Will do. |
@MattTheCuber Thanks, it's merged. Some CI runs failed but that's just coveralls being coveralls. |
#137 Add missing change description
With FIPS mode the following error is thrown.
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS