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

Allow for fast cached HMACs #27

Closed
wants to merge 6 commits into from
Closed

Conversation

Sc00bz
Copy link
Contributor

@Sc00bz Sc00bz commented Oct 12, 2018

  • Fixed array out of bounds bug
    • Note ((undefined ^ 0x36) == 0x36) so there's no real bug.
  • Use create-hash for hashes
    • create-hash was already required but not fully used. Doing so cleans up the code a little. Also legacy is no longer used.
  • Allow for fast cached HMACs
    • Cloning an Hmac object just after creation will allow for cached HMACs. Also if used in PBKDF2 it gets a 2x speed increase and avoids the long password DoS.

Note ((undefined ^ 0x36) == 0x36) so there's no real bug.
create-hash was already required but not fully used. Doing so cleans up the code a little. Also legacy is no longer used.
Cloning an `Hmac` object just after creation will allow for cached HMACs. Also if used in PBKDF2 it gets a 2x speed increase and avoids the long password DoS.
@calvinmetcalf
Copy link
Contributor

  1. we didn't use create-hash because it's a stream and adds some non-trivial overhead of object creation, we only required it to get it's sub file md5
  2. this is meant to copy the same api as node streams, which doesn't have a clone

@Sc00bz
Copy link
Contributor Author

Sc00bz commented Oct 12, 2018

I just assumed that hmac.write is another name for hmac.update, hmac.end did "nothing", and hmac.read is another name for hmac.digest. Or at least that's basically what it should be.

@Sc00bz
Copy link
Contributor Author

Sc00bz commented Oct 13, 2018

Anyway I assume this will not get merged so I'll just close.

@Sc00bz Sc00bz closed this Oct 13, 2018
@Sc00bz
Copy link
Contributor Author

Sc00bz commented Oct 13, 2018

Oh right the array out of bounds thing should be fixed tho... #28

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

Successfully merging this pull request may close these issues.

None yet

2 participants