Friday, May 17, 2013

Java

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.codec.binary.Base64;

public class WordsToLiveBy {

 public static void main(String[] args) {
  
  String value = "2UEnLAFR7aICwCQ8q6LfE2b7EGNZLExRtOb7FbI6R-0let8dqHnTB-R" + 
      "dIwM82gKaEwBzOhvyI2e7oqGWTTwbx2Krb54txM6juMH5FNpwNxbKCM" +
      "scaqf3N2G5kglXPMhzONnaWfp0Wxf5Kk7NZF0yAcLiPPkK3CTSbUDAk" + 
      "PLVa7kbZGjbTG1cjM0-1rvEB8mvwbPEH-GDcLg8uU7v-EzBAblRMovk" + 
      "_olXAklRo4AKNuikee7MPldNQf3zmWL2WsIyDOmgMc9LWKR1cq9rAyB" + 
      "744xfsxFLB1FYueyhTBKeezynxuLuYd5UUovXSUEbk8DL";
  
  try {
   
   SecretKey key = new SecretKeySpec("Rush2112FreeWill".getBytes(), "AES");
   Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
   Base64 coder = new Base64(32, new byte[] {}, true);
   cipher.init(Cipher.DECRYPT_MODE, key);
   byte[] decrypted = cipher.doFinal(coder.decode(value.getBytes()));
   System.out.println(new String(decrypted));
   
  } catch (Throwable t) {
   
   t.printStackTrace();
  }
 }
}