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

Why "sha1(mac) == sha1(val)" ? #19

Closed
lyenliang opened this issue Mar 28, 2015 · 3 comments
Closed

Why "sha1(mac) == sha1(val)" ? #19

lyenliang opened this issue Mar 28, 2015 · 3 comments

Comments

@lyenliang
Copy link

I'd like to know why use "sha1(mac) == sha1(val)" instead of "mac == val" at line 42 in index.js.
Is this some kind of security issue? Is it necessary to use sha1 here?

@lyenliang
Copy link
Author

I've got the answer on stackoverflow.

@natevw
Copy link
Collaborator

natevw commented Mar 28, 2015

If anyone else is wondering this, there is more discussion to be found starting at #15

@rlidwka
Copy link

rlidwka commented Mar 28, 2015

mac == val is prone to timing attacks. You can look for "timing attacks" in google/wiki/etc., there are plenty of information about it.

sha1(mac) == sha1(val) is presumed to be immune to it, because sha1 function output effectively randomizes bits.

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

3 participants