Skip to content

Main content

Decoding: CBOR Initial Byte Fields Tool

Split an RFC8949 CBOR initial byte into major type and additional information while retaining reserved28..30 evidence; no CBOR item or document decoding.

Loading tool…

Description

Split any initial octet into CBOR fields and a reserved-value flag.

CBOR initial bytes combine major type and additional information. Some fields are reserved or context-dependent, and a break marker is meaningful only within a correctly tracked indefinite-length container.

Split any initial octet into CBOR fields and a reserved-value flag.

When to use this tool

Use Decoding: CBOR Initial Byte Fields when inspecting one explicit CBOR field or supplied break context.

How to use the tool and how it works

  1. Enter initialByte. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Split any initial octet into CBOR fields and a reserved-value flag. Require whole initialByte in [0,255]; majorType = floor(byte/32), additionalInformation = byte modulo 32; flag values 28-30.1

CBOR splits the initial octet into major type and additional information. Reserved or indefinite forms need type and container context beyond a bit-field split.2

Input fieldMeaning and unitsAccepted input
initialByteInitial ByteRequired. Safe integer.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.majorTypeMajor TypeCalculated result member: number.
result.additionalInformationAdditional InformationCalculated result member: number.
result.reservedAdditionalInformationWhether the low five bits are 28, 29 or 30; these are reported rather than rejected.Calculated result member: boolean.
json
{
  "input": {
    "initialByte": 161
  },
  "output": {
    "result": {
      "majorType": 5,
      "additionalInformation": 1,
      "reservedAdditionalInformation": false
    }
  }
}

Limitations and assumptions

  • Reserved fields are reported rather than rejected; no following payload or type-specific validity is checked.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use a complete CBOR parser to track nesting, following arguments and type-specific validity.

References

  1. Calculation and input contract: decode/cbor-initial-byte-fields — tool.io

  2. RFC 8949: Concise Binary Object Representation — RFC Editor

Similar or alternative tools