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.

1  
import javax.crypto.Mac;
2  
import javax.crypto.spec.SecretKeySpec;
3  
4  
static byte[] hmacSHA256(byte[] message, byte[] key) ctex {
5  
  S algorithm = "HmacSHA256";
6  
  Mac mac = Mac.getInstance(algorithm);
7  
  mac.init(new SecretKeySpec(key, algorithm));
8  
  ret mac.doFinal(message);
9  
}
10  
11  
static byte[] hmacSHA256(S message, byte[] key) {
12  
  ret hmacSHA256(toUtf8(message), key);
13  
}

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: 73 / 115
Version history: 5 change(s)
Referenced in: [show references]