Skip to main content
Version: v0.0.4

Function: toChecksumHex()

toChecksumHex(checksum): string

Format a checksum byte as the two uppercase hex characters ASTM puts on the wire (the conservative-emit form). Decode accepts lowercase; emit is uppercase.

Parameters

checksum

number

A value in 0255.

Returns

string

Two uppercase hex characters, zero-padded (e.g. "0A", "75").

Example

import { toChecksumHex } from "@cosyte/astm";
toChecksumHex(0x0a); // "0A"