Table of Contents

Base85Variant Enum

Definition

Namespace
Bodu.Text.Encoding
Assembly
Bodu.Text.Encoding.dll
Package
Bodu.Text.Encoding 1.0.0
Source
Base85Variant.cs

Identifies the Base85 alphabet and framing rules used by Base85.

public enum Base85Variant : byte
Extension Methods

Fields

Ascii85 = 0

The Adobe Ascii85 alphabet, used by PDF and PostScript. Uses ASCII characters ! (0x21) through u (0x75). The character z is recognised as a shortcut for four zero bytes. Partial trailing groups of one, two, or three bytes are permitted; output length grows by one character per byte plus one.

Z85 = 1

The Z85 alphabet defined by ZeroMQ (RFC 32 / "ZMTP/2.0"). Uses a shell-safe alphabet that avoids quote, slash, semicolon, and backslash. No z shortcut is recognised, and the input length must be a multiple of four bytes (output length is then a multiple of five characters).

GitCompact = 2

The Git binary-patch Base85 alphabet with compact, self-delimiting partial-tail framing.

Uses the alphabet 0-9 A-Z a-z ! # $ % & ( ) * + - ; < = > ? @ ^ _ ` { | } ~. It does not use the Adobe z zero shortcut and does not use the Adobe <~ / ~> delimiters. Base85 emits a compact, self-delimiting partial tail (a final remainder of one, two, or three bytes becomes two, three, or four characters), which round-trips through Decode(ReadOnlySpan<char>, Base85Variant, BaseFormatStyles) without external metadata - this is not the exact Git binary-patch line encoding, which always emits five characters per group and carries the decoded byte count out of band. Use the EncodeGitPadded / DecodeGitPadded helpers for that patch-compatible primitive. This variant implements only the Git alphabet; it does not parse Git binary patches.

Remarks

Base85 encodes four bytes as five characters using radix 85. Variants differ in alphabet, alphabet ordering, the availability of the all-zero shortcut z, and whether partial trailing groups are permitted.

byte[] payload = "data"u8.ToArray();

var ascii85 = Base85.Encode(payload);                            // Adobe Ascii85
var z85 = Base85.Encode(payload, Base85Variant.Z85);             // ZeroMQ string-safe
var git = Base85.Encode(payload, Base85Variant.GitCompact);      // git binary patches

Applies to

ProductVersions
.NET8, 10