Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lz4bson cannot be loaded #4

Open
KisaragiEffective opened this issue Nov 2, 2023 · 6 comments
Open

lz4bson cannot be loaded #4

KisaragiEffective opened this issue Nov 2, 2023 · 6 comments

Comments

@KisaragiEffective
Copy link
Owner

KisaragiEffective commented Nov 2, 2023

ひねくれたblock headerを使っているからデコードできないらしい:

Long story short: block data is compatible with original (Yann's) LZ4 implementation, the block header is not.

K4os.Compressions.LZ4.Legacyを使えばデコードできるか?

@KisaragiEffective
Copy link
Owner Author

class Program
{
    static void Main(string[] args)
    {
        if (args.Length != 2)
        {
            System.Console.Error.WriteLine("Usage: [in: lz4bson] [out: bson]");
            return;
        }

        using var inFile = File.OpenRead(args[0]);
        using var legacyNonStandardLz4Stream = new LZ4Stream(inFile, LZ4StreamMode.Decompress);
        using var outFile = new FileStream(args[1], FileMode.Truncate);
        legacyNonStandardLz4Stream.CopyTo(outFile);
    }
}

むり

@KisaragiEffective
Copy link
Owner Author

行けた

@KisaragiEffective
Copy link
Owner Author

    1   3 366
    2 246  74
    3 240  46
    4   2 220
    5 272   0
    6 136   0
    7 366   3
    8  74 117
    9  46 142
   10 220 152
   11   0 145
   12   0 143
   13   3 164
   14 117   0
   15 142   6
   16 152 220
   17 145   0
   18 143   0
   19 164   2
   20   0 111

6バイト読み飛ばせば良さそう…?

@KisaragiEffective
Copy link
Owner Author

6バイト読み飛ばせば良さそう…?

176バイト目までは一致するが、それ以降が一致しないので単純な小細工ではだめっぽい

@KisaragiEffective
Copy link
Owner Author

181バイト目からビハインド3で追いかけているのでまた切り詰めてみる

@KisaragiEffective
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant