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

sm3的hmac模式加密结果与java不一致 #126

Open
cml-deee opened this issue Dec 12, 2024 · 0 comments
Open

sm3的hmac模式加密结果与java不一致 #126

cml-deee opened this issue Dec 12, 2024 · 0 comments

Comments

@cml-deee
Copy link

前端用sm-crypto的sm3加密:
sm3('11111',{key:'0123456789abcdeffedcba9876543210'}
后端用hutool的hmac加密:

public static void main(String[] args) {
String key = 0123456789abcdeffedcba9876543210";
String chars = HexUtil.encodeHexStr(key.getBytes());
System.out.println(chars);
String param="11111";
Mac hMac = SmUtil.hmacSm3(key。getBytes);
String s3 = hMac.digestHex(param);
System.out.println(s3);

得出来的结果不一样是为什么?

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

1 participant