Skip to content

Instantly share code, notes, and snippets.

@FrankWu100
Last active January 1, 2016 00:48
Show Gist options
  • Save FrankWu100/8068436 to your computer and use it in GitHub Desktop.
Save FrankWu100/8068436 to your computer and use it in GitHub Desktop.
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