JAVA代码示例
public static String generateSignature(String deviceNo, String expires, String appSecret) throws NoSuchAlgorithmException {
StringBuilder reversed = new StringBuilder(appSecret);
String combinedString = deviceNo + expires + appSecret + reversed.reverse();
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hashBytes = digest.digest(combinedString.getBytes(StandardCharsets.UTF_8));
String base64Hash = Base64.getEncoder().encodeToString(hashBytes);
return URLEncoder.encode(base64Hash,StandardCharsets.UTF_8.toString());
}
作者:mry 创建时间:2025-02-17 17:52
最后编辑:mry 更新时间:2025-09-09 10:58
最后编辑:mry 更新时间:2025-09-09 10:58