fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import javax.crypto.Cipher;
  7. import javax.crypto.spec.SecretKeySpec;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. Scanner sc = new Scanner(System.in);
  15. String token = sc.nextLine().replace('-','+').replace('_','/');
  16. byte[] decodedToken = Base64.getDecoder().decode(token);
  17.  
  18. SecretKeySpec keySpec = new SecretKeySpec(new String("Blowfish").getBytes(), "DES");
  19. Cipher cipher = Cipher.getInstance("DES");
  20. cipher.init(Cipher.DECRYPT_MODE, keySpec);
  21. byte[] decrypted = cipher.doFinal(decodedToken);
  22.  
  23. System.out.println(new String(decrypted, "UTF8"));
  24. }
  25. }
Runtime error #stdin #stdout #stderr 0.15s 321280KB
stdin
Kd-vYGzucTHJCqH1PfYuaRhDgyK2RgreLexXuNRtISw=-
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.IllegalArgumentException: Input byte array has incorrect ending byte at 44
	at java.util.Base64$Decoder.decode0(Base64.java:742)
	at java.util.Base64$Decoder.decode(Base64.java:526)
	at java.util.Base64$Decoder.decode(Base64.java:549)
	at Ideone.main(Main.java:16)