forked from BijanProgrammer/Base64Crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBase64Crypto.java
More file actions
40 lines (34 loc) · 2.09 KB
/
Base64Crypto.java
File metadata and controls
40 lines (34 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package base64crypto;
public class Base64Crypto {
static final String SEPARATOR = "----------------------------------------";
static String[] tests = new String[]{"Hello", "This is a test", "I want to encode me then decode me :D"};
public static void main(String[] args) {
for (String test : tests) {
String encoded = encrypt(test);
String decrypted = decrypt(encoded);
System.out.printf("%s%n%s -> %s%n%s -> %s%n", SEPARATOR, test, encoded, encoded, decrypted);
}
}
static String encrypt(String plainText) {
String result = plainText;
// Compelet it
return result;
}
static String decrypt(String base64) {
String result = base64;
// Compelet it
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Output //
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Hello -> SGVsbG8= //
// SGVsbG8= -> Hello //
// ---------------------------------------- //
// This is a test -> VGhpcyBpcyBhIHRlc3Q= //
// VGhpcyBpcyBhIHRlc3Q= -> This is a test //
// ---------------------------------------- //
// I want to encode me then decode me :D -> SSB3YW50IHRvIGVuY29kZSBtZSB0aGVuIGRlY29kZSBtZSA6RA== //
// SSB3YW50IHRvIGVuY29kZSBtZSB0aGVuIGRlY29kZSBtZSA6RA== -> I want to encode me then decode me :D //
//////////////////////////////////////////////////////////////////////////////////////////////////////////
}