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

13
LINES

< > BotCompany Repo | #1036023 // hmacSHA256

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (64L) is out of date.

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

static byte[] hmacSHA256(byte[] message, byte[] key) ctex {
  S algorithm = "HmacSHA256";
  Mac mac = Mac.getInstance(algorithm);
  mac.init(new SecretKeySpec(key, algorithm));
  ret mac.doFinal(message);
}

static byte[] hmacSHA256(S message, byte[] key) {
  ret hmacSHA256(toUtf8(message), key);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036023
Snippet name: hmacSHA256
Eternal ID of this version: #1036023/6
Text MD5: eb1725ff1f8fd7d01fb74aa7d9e4e252
Author: stefan
Category: javax / cryptography
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-01 13:37:11
Source code size: 377 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 69 / 108
Version history: 5 change(s)
Referenced in: [show references]