Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String sha1(String s, String keyString)
- throws UnsupportedEncodingException, NoSuchAlgorithmException,
- InvalidKeyException {
- SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"),
- "HmacSHA1");
- Mac mac = Mac.getInstance("HmacSHA1");
- mac.init(key);
- byte[] bytes = mac.doFinal(s.getBytes("UTF-8"));
- return new String(Base64.encodeToString(bytes, Base64.DEFAULT));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement