Hashcat Restore file: Java parsing library

File extension


KS implementation details

License: CC0-1.0

This page hosts a formal specification of Hashcat Restore file using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.


Runtime library

All parsing code for Java generated by Kaitai Struct depends on the Java runtime library. You have to install it before you can parse data.

The Java runtime library is published in the Maven Central Repository. Refer to the artifact page for instructions how to add it into your project with the build tool that you use.


Parse a local file and get structure in memory:

HashcatRestore data = HashcatRestore.fromFile("path/to/local/file.restore");

Or parse structure from a byte array:

byte[] someArray = new byte[] { ... };
HashcatRestore data = new HashcatRestore(new ByteBufferKaitaiStream(someArray));

After that, one can get various attributes from the structure by invoking getter methods like:

data.version() // => get version

Java source code to parse Hashcat Restore file


// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

import io.kaitai.struct.ByteBufferKaitaiStream;
import io.kaitai.struct.KaitaiStruct;
import io.kaitai.struct.KaitaiStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;

 * @see <a href="https://hashcat.net/wiki/doku.php?id=restore">Source</a>
public class HashcatRestore extends KaitaiStruct {
    public static HashcatRestore fromFile(String fileName) throws IOException {
        return new HashcatRestore(new ByteBufferKaitaiStream(fileName));

    public HashcatRestore(KaitaiStream _io) {
        this(_io, null, null);

    public HashcatRestore(KaitaiStream _io, KaitaiStruct _parent) {
        this(_io, _parent, null);

    public HashcatRestore(KaitaiStream _io, KaitaiStruct _parent, HashcatRestore _root) {
        this._parent = _parent;
        this._root = _root == null ? this : _root;
    private void _read() {
        this.version = this._io.readU4le();
        this.cwd = new String(KaitaiStream.bytesTerminate(this._io.readBytes(256), (byte) 0, false), Charset.forName("UTF-8"));
        this.dictsPos = this._io.readU4le();
        this.masksPos = this._io.readU4le();
        this.padding = this._io.readBytes(4);
        this.currentRestorePoint = this._io.readU8le();
        this.argc = this._io.readU4le();
        this.padding2 = this._io.readBytes(12);
        this.argv = new ArrayList<String>();
        for (int i = 0; i < argc(); i++) {
            this.argv.add(new String(this._io.readBytesTerm((byte) 10, false, true, true), Charset.forName("UTF-8")));
    private long version;
    private String cwd;
    private long dictsPos;
    private long masksPos;
    private byte[] padding;
    private long currentRestorePoint;
    private long argc;
    private byte[] padding2;
    private ArrayList<String> argv;
    private HashcatRestore _root;
    private KaitaiStruct _parent;
    public long version() { return version; }
    public String cwd() { return cwd; }
    public long dictsPos() { return dictsPos; }
    public long masksPos() { return masksPos; }
    public byte[] padding() { return padding; }
    public long currentRestorePoint() { return currentRestorePoint; }
    public long argc() { return argc; }
    public byte[] padding2() { return padding2; }
    public ArrayList<String> argv() { return argv; }
    public HashcatRestore _root() { return _root; }
    public KaitaiStruct _parent() { return _parent; }