有一些 SO 问题,但没有帮助我。我想将 byte[]
从 org.apache.commons.codec.digest.HmacUtils
转换为字符串。此代码产生一些奇怪的输出:
final String value = "value";
final String key = "key";
byte[] bytes = HmacUtils.hmacSha1(key, value);
String s = new String(bytes);
我做错了什么?
最佳答案
尝试使用:
String st = HmacUtils.hmacSha1Hex(key, value);
关于java - 如何在 Java 中将 byte[] 转换为 String?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32801198/