Roy Ashbrook

let go or be dragged
posts - 198, comments - 29, trackbacks - 8

Minecraft Password Recovery from lastlogin file

A few months ago my kids and I started up another round of playing Minecraft. The only issue was my daughter had forgotten her password and she lost the password to the email she registered it on and she couldn’t remember her questions etc to recover the password.

So as I was looking for ways to recover her password I came across a way to recover it from the lastlogin file used by Minecraft if you check the ‘save password’ box, which she had done fortunately months previously when she last played. I used the Java code below and it worked like a champ. I can’t remember exactly what source I used for this and I modified it slightly, but if you search for “43287234L” you will probably be able to find a lot of the original links.

Hopefully it helps someone. Saved me a boatload of time ‘not playing’ while we worked to eventually recover all of the accounts and passwords.

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);
    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];
        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();

        return output;

Print | posted on Wednesday, March 20, 2013 11:28 AM | Filed Under [ DEV ]

Comments have been closed on this topic.

Powered by: