Aliphaticus.Lzb16Decoder 0.1.0

dotnet add package Aliphaticus.Lzb16Decoder --version 0.1.0
                    
NuGet\Install-Package Aliphaticus.Lzb16Decoder -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aliphaticus.Lzb16Decoder" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aliphaticus.Lzb16Decoder" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Aliphaticus.Lzb16Decoder" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aliphaticus.Lzb16Decoder --version 0.1.0
                    
#r "nuget: Aliphaticus.Lzb16Decoder, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aliphaticus.Lzb16Decoder@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aliphaticus.Lzb16Decoder&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Aliphaticus.Lzb16Decoder&version=0.1.0
                    
Install as a Cake Tool

Aliphaticus.Lzb16Decoder

Aliphaticus.Lzb16Decoder is a managed decoder for Oodle LZB16 payloads in FromSoftware DCX_KRAK files, including Elden Ring files whose Oodle stream decoder type is 0x02.

Why LZB16?

DCX_KRAK identifies the Oodle container family, not necessarily the Kraken codec. The codec is selected by the decoder ID in the Oodle block header:

Stream decoder ID Codec
0x02 LZB16
0x06 Kraken

The 0x02 files found in Elden Ring are LZB16, sometimes described as Oodle's 64 KiB-window LZ4 variant. They are not LZHLW. In particular, the byte stored in the stream uses Oodle's decoder-ID numbering, which differs from the public OodleLZ_Compressor enum used when compressing.

Scope

The intended library scope is deliberately narrow:

  • Decode LZB16 streams with decoder type 0x02.
  • Support the Oodle framing used by Elden Ring's DCX_KRAK payloads.
  • Be fully managed and have no runtime dependency on oo2core.

It does not provide compression, a general DCX/container reader, or decoders for Kraken and other Oodle codecs. Applications must parse the DCX container, supply the exact Oodle payload and declared uncompressed size, and dispatch decoder type 0x06 to a Kraken decoder themselves.

Usage

using Aliphaticus.Lzb16Decoder;

// The caller parses DCX and supplies its exact Oodle payload plus
// the DCX-declared uncompressed size.
ReadOnlySpan<byte> oodlePayload = GetPayloadAfterDcxHeader();
long uncompressedSize = GetDcxUncompressedSize();

ILzb16Decoder decoder = new ManagedLzb16Decoder();
byte[] decoded = decoder.Decompress(oodlePayload, uncompressedSize);

Format observations

The implementation is being reconstructed from observed streams and black-box interoperability tests. The following framing facts have been verified against Elden Ring LZB16 payloads:

  • The decoder accepts one complete Oodle block whose stream decoder type is 0x02. Compressed blocks observed in the corpus begin with 8C 02.
  • The LZB16 quantum header is two bytes: big-endian compressed size minus one (BE16 + 1). The encoded stream begins at payload offset +4; this differs from Kraken's three-byte quantum header.
  • Literal bytes are stored verbatim. The token's low nibble gives the literal length, with LZ4-style extension bytes when the nibble is 15.
  • A 0xCC block flag represents a supported uncompressed/raw block, handled as framing rather than as a separate codec.

Malformed or truncated payloads, incorrect decoder types, invalid back-references, declared-output-size mismatches, and trailing compressed bytes are rejected. The decoder does not support multi-block payloads.

Clean-room approach

There is no known open-source LZB16 decoder to port. This project is a clean-room reconstruction based on file-format observations and outputs generated by a native Oodle decoder used only as a black-box oracle. It does not distribute, load, disassemble, or otherwise depend on oo2core.

Validation

The decoder is validated against native-Oodle SHA-256 oracle manifests for all 1,135 identified Elden Ring LZB16 payloads: 278 loose DCX files and 857 Havok payloads inside BXF4 archives. Each decoded payload is at most 2,040 bytes, making exhaustive byte-for-byte verification practical.

The test suite also covers malformed and truncated input, declared-size mismatches, trailing input, invalid output bounds, raw-block handling, and deterministic fuzz regressions.

Corpus files and oracle manifests stay outside Git. Copy .env.template to .env and configure these absolute paths to run the full corpus suites:

  • LZB16_LOOSE_CORPUS_PATH
  • LZB16_LOOSE_CORPUS_MANIFEST
  • LZB16_ARCHIVE_CORPUS_PATH
  • LZB16_ARCHIVE_CORPUS_MANIFEST

License

Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 88 9/10/2026

Initial public release. Adds managed decoding for Oodle stream decoder type 0x02 (LZB16), including stored 0xCC blocks. Non-LZB16 codecs are intentionally unsupported.