Skip to content

Instantly share code, notes, and snippets.

@NeilHanlon
Last active May 27, 2016 19:12
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeilHanlon/4686779 to your computer and use it in GitHub Desktop.
Save NeilHanlon/4686779 to your computer and use it in GitHub Desktop.
package com.snapchat.android.util;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class AESEncrypt
{
public static String ENCRYPT_KEY = "1234567891123456";
public static String ENCRYPT_KEY_2 = "M02cnQ51Ji97vwT4";
public static byte[] decrypt(byte[] paramArrayOfByte, String paramString)
throws Exception
{
Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
localCipher.init(2, new SecretKeySpec(paramString.getBytes(), "AES"));
return localCipher.doFinal(paramArrayOfByte);
}
public static byte[] encrypt(byte[] paramArrayOfByte, String paramString)
throws Exception
{
Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
localCipher.init(1, new SecretKeySpec(paramString.getBytes(), "AES"));
return localCipher.doFinal(paramArrayOfByte);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment