Description
Return wireKey = fieldNumber*8+wireType.
Protocol Buffer integer fields separate a numeric key, signed-value mapping and byte representation. Varint groups carry seven payload bits plus continuation, while ZigZag and sign-extended integer types represent negative values differently.
Return wireKey = fieldNumber*8+wireType.
When to use this tool
Use Encoding: Protocol Buffers Wire Key Scalar Fields when inspecting one supplied protobuf integer or key-encoding component.
How to use the tool and how it works
- Enter fieldNumber, wireType. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Require whole fieldNumber in [1,536870911] excluding 19000-19999 and whole wireType in [0,5]. Return wireKey = fieldNumber*8+wireType.1
Protobuf separates keys, varints, fixed-width payloads and signed mappings. A local field transformation does not encode a complete message.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| fieldNumber | Field Number | Required. Safe integer. |
| wireType | Whole wire type 0-5; legacy group codes are accepted. | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the named calculated members below. | Required. Object. |
| result.wireKey | Wire Key | Calculated result member: number. |
{
"input": {
"fieldNumber": 2,
"wireType": 2
},
"output": {
"result": {
"wireKey": 18
}
}
} Limitations and assumptions
- The output is a numeric protobuf key before varint encoding. Legacy group wire types 3 and 4 are accepted; message schemas, field semantics and payload compatibility are not 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 conforming complete serializer and message schema for full wire encoding, payload validation and interoperability.
References
-
Calculation and input contract: encode/protobuf-wire-key-scalar-fields — tool.io
-
Protocol Buffers wire encoding — Protocol Buffers
Similar or alternative tools
- Protocol Buffers Fixed32 Octet Fields
Return four octets floor(value/256^i) modulo 256 for i = 0,1,2,3, in least-significant-byte-first order.
- Protocol Buffers Enum Negative Wire Representation
Show a negative int32 value’s sign-extended unsigned64 argument and ten-byte varint length.