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

18
LINES

< > BotCompany Repo | #1005130 // Test aesEncryptString + aesDecryptString

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1305L/10K/35K).

!7

p {
  S s = repString("hello world. ", 10);
  print(s);
  final S enc = aesEncryptString(s, "pw 1");
  print(enc);
  int l1 = l(toUtf8(s));
  int l2 = l(toUtf8(enc));
  int percent = ratioToIntPercent(l2, l1);
  print("Length: " + l1 + " -> " + l2 + " (\*percent*/%)");
  assertEquals(s, aesDecryptString(enc, "pw 1"));
  assertFail(r {
    aesDecryptString(enc, "pw 2");
  });
  printStackTrace_indent("HARMLESS", lastSilentException());
  print("ENCRYPT/DECRYPT/WRONG PASSWORD TEST OK!");
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005130
Snippet name: Test aesEncryptString + aesDecryptString
Eternal ID of this version: #1005130/3
Text MD5: 09acbfaa4c443d855d462ecde511367a
Transpilation MD5: 186547772232618a3dbf9aedf634a1fd
Author: stefan
Category: javax / cryptography
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-24 12:13:39
Source code size: 513 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 819 / 1109
Version history: 2 change(s)
Referenced in: [show references]