Skip to content

Main content

Msgpack Fixstr Length Prefix Tool

Calculate msgpack fixstr length prefix from explicit caller-supplied inputs.

Loading tool…

Description

Return octet = 160+utf8Bytes, combining the fixstr tag with its five-bit byte length.

MessagePack uses compact tag families for small integers, short strings and small containers. A header can carry a count directly, but that count must agree with the following encoded items or UTF-8 bytes.

Return octet = 160+utf8Bytes, combining the fixstr tag with its five-bit byte length.

When to use this tool

Use Msgpack Fixstr Length Prefix when constructing one compact MessagePack header or scalar byte.

How to use the tool and how it works

  1. Enter utf8Bytes. 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 octet. Use the output convention below.

Require whole utf8Bytes in [0,31]. Return octet = 160+utf8Bytes, combining the fixstr tag with its five-bit byte length.1

Input fieldMeaning and unitsAccepted input
utf8BytesSupplied UTF-8 payload length in bytes, from zero through 31.Required. Safe integer; minimum 0; maximum 31.
Output fieldInterpretationReturned shape
octetOctetRequired. Safe integer.
json
{
  "input": {
    "utf8Bytes": 5
  },
  "output": {
    "octet": 165
  }
}

Limitations and assumptions

  • The length is supplied and counts UTF-8 bytes, not characters. No string encoding, payload or overall MessagePack validation is performed.
  • 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 MessagePack serializer for payload encoding, nested structure and interoperable validation.

References

  1. Calculation and input contract: encode/msgpack-fixstr-length-prefix — tool.io

Similar or alternative tools