fork download
  1. import java.nio.ByteBuffer;
  2. import javax.crypto.Cipher;
  3. import javax.crypto.spec.SecretKeySpec;
  4.  
  5. class Test {
  6. public static void main(String[] args) {
  7.  
  8. try {
  9.  
  10. byte[] bs = {
  11. (byte)0x03, (byte)0x01, (byte)0x00, (byte)0x00,
  12. (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00
  13. };
  14. ByteBuffer buff = ByteBuffer.wrap(bs);
  15. Cipher instance = Cipher.getInstance("RC4");
  16. instance.init(Cipher.DECRYPT_MODE, new SecretKeySpec(("c2eWxyNe5c4G9GUHMQECzcUEWUK8MWkk" + "48LoIDEv8EQOrmwPirikDa3iUaickMSq").getBytes(), "RC4"));
  17. instance.update(buff.array(), 0, 8, buff.array(), 0);
  18. byte[] array = buff.array();
  19. for (int j=0; j<array.length; j++) {
  20. System.out.format("%02X ", array[j]);
  21. }
  22. System.out.println();
  23. //CA 66 C4 5D 90 E7 30 01
  24. byte[] bs1 = {
  25. (byte)0xca, (byte)0x66, (byte)0xc4, (byte)0x5d,
  26. (byte)0x90, (byte)0xe7, (byte)0x30, (byte)0x01
  27. };
  28. ByteBuffer buff1 = ByteBuffer.wrap(bs1);
  29. Cipher instance1 = Cipher.getInstance("RC4");
  30. instance1.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(("c2eWxyNe5c4G9GUHMQECzcUEWUK8MWkk" + "48LoIDEv8EQOrmwPirikDa3iUaickMSq").getBytes(), "RC4"));
  31. instance1.update(buff.array(), 0, 8, buff.array(), 0);
  32. byte[] array1 = buff.array();
  33. for (int j=0; j<array1.length; j++) {
  34. System.out.format("%02X ", array1[j]);
  35. }
  36. System.out.println();
  37. //03 01 00 00 02 00 00 00
  38. }catch (Throwable th) {
  39. System.out.println(th);
  40. System.exit(0);
  41. }
  42. }
  43.  
  44.  
  45. }
Success #stdin #stdout 0.08s 2316288KB
stdin
Standard input is empty
stdout
java.security.NoSuchAlgorithmException: Cannot find any provider supporting RC4