|
50精币
比如
/ An highlighted block
public String getNsTokenSig(String sig,String token) throws NoSuchAlgorithmException {
String str2 = sig+token;
return new String(b(MessageDigest.getInstance("SHA-256").digest(str2.getBytes())));
}
private static char[] b(byte[] bArr) {
char[] b = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
char[] cArr = b;
int length = bArr.length;
char[] cArr2 = new char[(length << 1)];
int i = 0;
for (int i2 = 0; i2 < length; i2++) {
int i3 = i + 1;
cArr2[i] = cArr[(bArr[i2] & 240) >>> 4];
i = i3 + 1;
cArr2[i3] = cArr[bArr[i2] & 15];
}
return cArr2;
}
这样一段算法 怎么在易语言中使用它?
|
|