Skip to content

Commit

Permalink
feat: add helper to hash bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
metalurgical committed Sep 6, 2023
1 parent cb68693 commit e66a137
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ private TSSHelpers() {
* @return String
*/
public static String hashMessage(String message) {
byte[] hashedData = Hash.sha3(message.getBytes(StandardCharsets.UTF_8));
byte[] bytes = message.getBytes(StandardCharsets.UTF_8);
return hashMessage(bytes);
}

/**
* Hashes message bytes using Keccak
*
* @param message The message bytes to be hashed.
* @return String
*/
public static String hashMessage(byte[] message) {
byte[] hashedData = Hash.sha3(message);
return android.util.Base64.encodeToString(hashedData, Base64.NO_WRAP);
}

Expand Down

0 comments on commit e66a137

Please sign in to comment.