Skip to content

Commit aa64bf9

Browse files
committed
android: Change SHA of a string to return hex
This makes the API the same as iOS which returns hex when the input is a string. This discrepancy has been around for a long time and may break things for some people.
1 parent 9d979ff commit aa64bf9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

android/src/main/java/com/pedrouid/crypto/RCTSha.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void shaBase64(String data, String algorithm, Promise promise) throws Exc
8787
public void shaUtf8(String data, String algorithm, Promise promise) throws Exception {
8888
try {
8989
byte[] digest = this.sha(data.getBytes(), algorithm);
90-
promise.resolve(Base64.encodeToString(digest, Base64.DEFAULT));
90+
promise.resolve(Util.bytesToHex(digest));
9191
} catch (Exception e) {
9292
promise.reject("-1", e.getMessage());
9393
}

0 commit comments

Comments
 (0)