从比特币钱包文件中提取参数

问题描述 投票:0回答:0

我需要从类似比特币的钱包(比特币/litecoin/dogecoin)中提取 encryptedKey、salt、derivationMethod、derivationIterations 参数,就像在此处完成的一样,但在 java 中:https://github.com/openwall/john/blob/ bleeding-jumbo/run/bitcoin2john.py

据我了解,您需要读取大小为 16384 的字节块,直到其中一个包含字符串 mkey,但我还不知道如何完成所有操作。

我做了以下操作,但我不知道如何进一步阅读参数,或者我是否做对了:

    FileInputStream walletFile = new FileInputStream(datFile);
    byte[] curBlock = new byte[16384];
    int bytesRead = walletFile.read(curBlock);
    while (bytesRead > 0) {
        String blockAsString = new String(curBlock, StandardCharsets.US_ASCII);
        if (blockAsString.toLowerCase().contains("mkey")) {
            //reading parameters
        }
        curBlock = new byte[16384];
        bytesRead = walletFile.read(curBlock);
    }
java bitcoin
© www.soinside.com 2019 - 2024. All rights reserved.