Sunday, August 2, 2009
skNiNe9's SKCrackMe #1
Its a Java crackme. I am trying to learn java so i gave it a shot. It uses DES encryption in ECB mode or rather DES decryption to verify the serial. This as how DES can be implemented in java.
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class DES
{
public byte[] getDES(byte[] inputbytes, byte[] keybytes) throws Exception
{
SecretKeySpec key = new SecretKeySpec(keybytes,"DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] cryptedTxt = cipher.doFinal(inputbytes);
return cryptedTxt;
}
public byte[] decryptDES(byte[] inputbytes, byte[] keybytes) throws Exception
{
SecretKeySpec key = new SecretKeySpec(keybytes,"DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] decryptedtxt = cipher.doFinal(inputbytes);
return decryptedtxt;
}
}
Have fun implementing DES :P
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment