Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1023345 // sha256

JavaX fragment (include)

sS sha256(S text) ctex {
  if (text == null) ret "-";
  return bytesToHex(sha256_impl(toUtf8(text)));
}

sS sha256(byte[] data) {
  if (data == null) ret "-";
  ret bytesToHex(sha256_impl(data));
}

static byte[] sha256_impl(byte[] data) ctex {
  return MessageDigest.getInstance("SHA-256").digest(data);
}

Author comment

Began life as a copy of #1000998

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023345
Snippet name: sha256
Eternal ID of this version: #1023345/1
Text MD5: 36908ec572a5a114d15c7d92440321e0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-06 20:50:49
Source code size: 318 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 229 / 268
Referenced in: [show references]