Android中hmac用法
try {
String key = "1234567890", pass="pass";
SecretKeySpec sks = new SecretKeySpec(key.getBytes(), "hmacmd5");
Mac mac = Mac.getInstance("hmacmd5");
mac.init(sks);
mac.update(pass.getBytes());
byte[] result = mac.doFinal();
} catch (NoSuchAlgorithmException e) {
} catch (InvalidKeyException e) {
} catch (NumberFormatException e){
e.printStackTrace();
}
摘自cdzwm的专栏
补充:移动开发 , Android ,