Base85Variant Enum
Definition
Identifies the Base85 alphabet and framing rules used by Base85.
public enum Base85Variant : byte
- Extension Methods
Fields
Ascii85 = 0The Adobe Ascii85 alphabet, used by PDF and PostScript. Uses ASCII characters
!(0x21) throughu(0x75). The characterzis 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 = 1The Z85 alphabet defined by ZeroMQ (RFC 32 / "ZMTP/2.0"). Uses a shell-safe alphabet that avoids quote, slash, semicolon, and backslash. No
zshortcut is recognised, and the input length must be a multiple of four bytes (output length is then a multiple of five characters).GitCompact = 2The 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 Adobezzero 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 theEncodeGitPadded/DecodeGitPaddedhelpers 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
| Product | Versions |
|---|---|
| .NET | 8, 10 |