Skip to content

Instantly share code, notes, and snippets.

@paddybyers
paddybyers / gist:3782869
Created September 25, 2012 16:14 — forked from Honigbaum/gist:3782352
Encryption
Java:
String encrypt(String inputString) {
IvParameterSpec ivSpec = new IvParameterSpec("c1234567-zipl-03".getBytes());
SecretKeySpec keySpec = new SecretKeySpec("GeN8IfCrdxKxMxFA".getBytes(), "AES");
Cipher cipher;
try {
cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
@paddybyers
paddybyers / gist:3782863
Created September 25, 2012 16:13 — forked from Honigbaum/gist:3782352
Encryption
IvParameterSpec ivSpec = new IvParameterSpec("c1234567-zipl-03".getBytes());
SecretKeySpec keySpec = new SecretKeySpec("GeN8IfCrdxKxMxFA".getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
return "1" + bytesToHex(cipher.doFinal("Test".getBytes()));
@paddybyers
paddybyers / gist:3782857
Created September 25, 2012 16:13 — forked from Honigbaum/gist:3782352
Encryption
IvParameterSpec ivSpec = new IvParameterSpec("c1234567-zipl-03".getBytes());
SecretKeySpec keySpec = new SecretKeySpec("GeN8IfCrdxKxMxFA".getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
return "1" + bytesToHex(cipher.doFinal("Test".getBytes()));