Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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