Skip to content
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

[Question] - Why use bitwise comparison for the hmac_equals? #8

Open
larsqa opened this issue Apr 27, 2023 · 1 comment
Open

[Question] - Why use bitwise comparison for the hmac_equals? #8

larsqa opened this issue Apr 27, 2023 · 1 comment

Comments

@larsqa
Copy link

larsqa commented Apr 27, 2023

Hi @soatok,

Foremost, amazing blog and library. You provide some great resources for understanding cryptography better!

I'm curious, from your blog post about "Double HMAC Validation", the PHP code snippet uses === (tripple string comparison).

However, in this POC library, you're using bitwise comparison to compare both HMAC's.

Is there any specific reason for this?

(p.s. Keep up the good work :) )

@soatok
Copy link
Owner

soatok commented Nov 15, 2023

Either solution is effective on its own, but if I was lazy and used === , someone might have reported it as a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants