Last active
May 27, 2016 19:12
-
-
Save NeilHanlon/4686779 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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