Converting HMAC-SHA1 from node.js to Java

▼魔方 西西 提交于 2019-12-04 19:26:47

I figured it out!

Turns out I was doing one unnecessary step.

This line:

byte[] result = mac.doFinal();

Already contained the signature hash. I needed to convert that byte array to a hex string, not the digest of that byte array.

So the working code was simply:

byte[] result = mac.doFinal();
return byteArrayToHex(result);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!