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

13
LINES

< > BotCompany Repo | #1005123 // crypto_makeAESKey

JavaX fragment (include)

1  
import javax.crypto.*;
2  
3  
static SecretKey crypto_makeAESKey(S password, byte[] salt) ctex {
4  
  SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
5  
    
6  
  // only with unlimited strength:
7  
  //KeySpec spec = new PBEKeySpec(password, salt, 65536, 256);
8  
  
9  
  // Let's try this:
10  
  KeySpec spec = new PBEKeySpec(toCharArray(password), salt, 65536, 128);
11  
  
12  
  ret new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005123
Snippet name: crypto_makeAESKey
Eternal ID of this version: #1005123/1
Text MD5: c20692728a1e65ea116a49ea290b0db5
Author: stefan
Category: javax / cryptography
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-16 21:18:00
Source code size: 464 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 455 / 472
Referenced in: [show references]