Last active
January 1, 2016 00:48
-
-
Save FrankWu100/8068436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
public class Encryptor { | |
public static void main(String[] args) throws Exception{ | |
/* | |
//Sample Code | |
String msg = "this is msg"; | |
String keyStr = "this is key"; | |
String ivStr = "this is iv"; | |
System.out.println("Before Encrypt: " + msg); | |
System.out.println("Before slatStr: " + saltStr(msg)); | |
String ansBase64 = encryptSaltToBase64(ivStr, keyStr, msg); | |
System.out.println("slatStr Encrypt & To Base64: " + ansBase64); | |
*/ | |
} | |
public static String saltStr(String enStr){ | |
Date nowDate = new Date(); | |
String newEnStr = nowDate.getTime()/1000 + ";" + enStr; | |
return newEnStr; | |
} | |
public static String encryptSaltToBase64(String ivStr, String keyStr, String enStr) throws Exception{ | |
return AESEnDecryption.encryptStrToBase64(ivStr, keyStr, saltStr(enStr)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment