Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Created February 25, 2018 13:30
Show Gist options
  • Select an option

  • Save royashbrook/794b5d7617822170850287fd33664a4c to your computer and use it in GitHub Desktop.

Select an option

Save royashbrook/794b5d7617822170850287fd33664a4c to your computer and use it in GitHub Desktop.
import java.io.*;
import java.util.*;
import javax.crypto.*;
import javax.crypto.spec.*;
public class mcreco {
public static void main(String[] args) throws Exception {
String p = "Path To Your lastlogin file for minecraft";
String r = mcd(p);
System.out.println(r);
}
public static String mcd(String p) throws Exception {
PBEKeySpec pk = new PBEKeySpec("passwordfile".toCharArray());
String ci = "PBEWithMD5AndDES";
String output = null;
Random random = new Random(43287234L);
byte[] salt = new byte[8];
random.nextBytes(salt);
PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 5);
SecretKey pbeKey = SecretKeyFactory.getInstance(ci).generateSecret(pk);
Cipher cipher = Cipher.getInstance(ci);
cipher.init(2, pbeKey, pbeParamSpec);
DataInputStream dis = new DataInputStream(
new CipherInputStream(
new FileInputStream(new File(p)), cipher));
output = dis.readUTF() + " | " + dis.readUTF();
dis.close();
return output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment