Libraryless. Click here for Pure Java version (1305L/10K/35K).
1 | !7 |
2 | |
3 | p {
|
4 | S s = repString("hello world. ", 10);
|
5 | print(s); |
6 | final S enc = aesEncryptString(s, "pw 1"); |
7 | print(enc); |
8 | int l1 = l(toUtf8(s)); |
9 | int l2 = l(toUtf8(enc)); |
10 | int percent = ratioToIntPercent(l2, l1); |
11 | print("Length: " + l1 + " -> " + l2 + " (\*percent*/%)");
|
12 | assertEquals(s, aesDecryptString(enc, "pw 1")); |
13 | assertFail(r {
|
14 | aesDecryptString(enc, "pw 2"); |
15 | }); |
16 | printStackTrace_indent("HARMLESS", lastSilentException());
|
17 | print("ENCRYPT/DECRYPT/WRONG PASSWORD TEST OK!");
|
18 | } |
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: | 1143 / 1508 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |