-
Notifications
You must be signed in to change notification settings - Fork 48
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
HMAC.finalize( word_array ) doesn't appear to update properly? #62
Comments
works fine for me: const triplesec = require('triplesec');
const HMAC = triplesec.HMAC;
const WordArray = triplesec.WordArray;
const crypto = require('crypto');
let key = "this is my key";
let payload = "this is the payload";
let hmac1 = crypto.createHmac("SHA512", key);
console.log(hmac1.update(payload).digest('hex'));
let hmac2 = new HMAC(WordArray.from_utf8(key));
console.log(hmac2.finalize(WordArray.from_utf8(payload)).to_hex()) |
Outputs:
|
...this was the key! I was using Can I convert this into a bug report then? "No examples of how to use WordArray or HMAC in the documentation?" ...especially https://www.npmjs.com/package/triplesec In addition, if the object is "newed" incorrectly (ie: as above, If this stays open for longer than a week, I'll maybe try and get a PR up for documentation examples, but for now, thanks a bunch for pointing me in the right direction! |
Sure |
Maybe this is a real dumb issue, but I'm finding it impossible to get the above code to work (simple HMAC signing).
I've been through the project README's, the CODA docs, the hmac.iced code, etc. and am able to get EXACTLY the same thing working via node's built-in crypto (which unfortunately doesn't work in the browser). I'm smart enough about crypto that I know I should be using HMAC for digest validation (not MD5/SHA) but what is going on here? Why isn't "triplesec" working the way I think it should? I've already got it working it working with triplesec.encrypt, triplesec.decrypt, new triplesec.Buffer( key / ciphertext ), etc. but I am going mad trying to figure out how I'm incorrectly calling this HMAC function!!?
...and the "somewhat proper" output I'm expecting for use of crypto / HMAC / signing.
The text was updated successfully, but these errors were encountered: