Byte utilities for smart-card and embedded work
Eleven browser-local tools for the byte-level jobs that come up when reading APDU traces and building payloads: ASCII and hex conversion, byte-array formats, binary/hex/decimal arithmetic, byte offsets, checksums, CRC, LRC, SHA hashes, endian swaps, BER-TLV length fields and a JSON bin builder. Nothing you enter is uploaded.
ASCII ↔ HEX Converter
Convert ASCII text into a hex byte sequence (or back). Choose your preferred separator. ASCII characters (0x20–0x7E) only — for multi-byte characters use the UTF-8 inspector.
Input
Result
When to use this
For embedding strings into APDUs, building NDEF payloads, or converting between log captures and source code.
ASCII ↔ hex, and why it matters
This tool converts between human-readable text and its byte values shown in hexadecimal. Every character maps to one or more bytes; the hex view shows those bytes explicitly, which is invaluable when you are reading a protocol trace, a smart-card APDU log, or a hex dump and need to know what the bytes actually spell.
Worked example: the text AB is the two bytes 41 42 in hex (ASCII 0x41 = 'A', 0x42 = 'B'). Going the other way, 48 69 decodes to Hi. Note that non-ASCII characters depend on the text encoding — a character like é is one byte in Latin-1 but two bytes (C3 A9) in UTF-8, so confirm the encoding before trusting a conversion.
Frequently asked questions
Why do I get more hex bytes than characters?
Because non-ASCII characters are multi-byte in UTF-8. An emoji or an accented letter expands to several bytes, so the hex output is longer than the visible character count.
Can I paste hex with spaces or 0x prefixes?
Yes — the parser tolerates spaces and common separators. If you need strict byte grouping or prefixing, use the companion Hex ↔ Bytes formatter.
Is my input uploaded?
No. The conversion is done locally in your browser.
Which text encoding does the conversion assume?
UTF-8. That is why characters outside the ASCII range expand to more than one byte, and why a byte sequence that is not valid UTF-8 will not round-trip back to the same text.
Does hex output preserve leading zeros?
Yes. Every byte is rendered as exactly two hex digits, so 0x0A stays 0a rather than collapsing to a. This matters when the result is compared byte-for-byte against a key or hash.
Binary, hex and decimal calculator
Convert between binary, decimal, hex, and octal, then run bitwise AND, OR, XOR, NOT and shifts at a chosen 8/16/32/64-bit width — with signed/unsigned and two’s-complement views. BigInt-backed so 64-bit math stays exact.
How to use this tool
What it does
Performs bitwise and base conversions — AND/OR/XOR/shift across binary, hex and decimal.
When to use it
Use it when composing a flags byte or masking a field and you want to see the result in every base at once.
Worked example
XOR 0xF0 with 0x0F to get 0xFF, shown in binary and decimal too.
Base converter
Bitwise operation
What this calculator does
This is a binary calculator built for embedded and security engineers who spend their days staring at registers, status words, and bit-packed flags. The left panel is a live base converter: type a value once and read it back in binary, decimal, hexadecimal, and octal at the same time. The right panel runs the bitwise operations you reach for when masking flags or assembling protocol fields — AND, OR, XOR, NOT, and the three shifts (left, logical right, arithmetic right). Both panels share the same notion of operand width and signedness, so the bit pattern you convert is the bit pattern you operate on.
Everything is computed with JavaScript BigInt and then masked to the selected width. That matters more than it sounds: the native JavaScript bitwise operators silently coerce their inputs to signed 32-bit integers, so a 64-bit mask, a 40-bit APDU field, or any value past 2147483647 comes out wrong. Using BigInt and an explicit width mask keeps 8, 16, 32, and 64-bit results exact and lets the signed view show genuine two’s-complement values.
When to use it
Reach for it whenever a value crosses a representation boundary. Decoding a smart-card status word and need to see 0x9000 as bits? Building an ISO 7816 class byte or an EMV tag bitmap one flag at a time? Checking that a left shift wraps the way the silicon will at 8 bits? Confirming that 0xFF is −1 when a field is signed? Each of those is a few keystrokes here. It also pairs naturally with byte-order work: convert a value, then take the hex into the endian converter to swap byte order, or into hex bytes to view it as a byte sequence.
Input and output
In the base converter, choose which base your typed value is in and the tool parses it accordingly; you can also paste with a 0x, 0b, or 0o prefix and it will infer the base. The output shows all four bases plus a nibble-grouped binary view (four bits per group) so long patterns stay readable. In the bitwise panel, operands A and B are read in the selected operand base; for NOT only operand A is used, and for shifts operand B is the shift amount. Results are masked to the active width and reported in binary, hex, decimal (both unsigned and signed two’s-complement), and octal. If a value does not fit the width, the high bits are dropped and the tool flags the truncation rather than hiding it.
Common mistakes
- Trusting native JS bit-ops past 32 bits.
(0xFFFFFFFF & 0xFFFFFFFF)evaluates to-1in plain JavaScript. This tool uses BigInt to avoid that trap entirely. - Confusing logical and arithmetic right shift. Shifting a negative signed value right with the logical shift zero-fills the sign bit and changes its meaning; pick the arithmetic shift to preserve sign.
- Forgetting the width when reading two’s complement. The pattern
0x80is −128 at 8 bits but a positive 128 at 16 bits. Set the width to match the register. - Entering a value wider than the field. A 9-bit number in an 8-bit width is truncated; watch for the truncation badge.
- Mixing operand bases. A and B are read in the single selected operand base — switch the base selector rather than prefixing only one operand.
Related tools
Frequently asked questions
Why use BigInt instead of plain JavaScript bitwise operators?
JavaScript's &, |, ^, ~, and shift operators coerce their operands to signed 32-bit integers, so any value above 2^31-1 is silently truncated or flips sign. That makes them useless for 64-bit registers and unreliable even at 32 bits. This calculator performs every operation on BigInt values and masks the result to the selected width, so 8, 16, 32, and 64-bit results are all exact.
What is the difference between logical and arithmetic right shift?
A logical right shift (often written >>>) always fills the vacated high bits with zero, treating the value as unsigned. An arithmetic right shift (>>) replicates the sign bit so that a negative two's-complement number stays negative — it divides by powers of two with rounding toward negative infinity. This tool offers both and lets you pick the operand width that defines where the sign bit sits.
How is two's complement shown here?
When you set the interpretation to signed, the most significant bit of the chosen width is the sign bit. A value with that bit set is shown as a negative decimal equal to value minus 2^width, while the binary, hex, and octal views always show the raw unsigned bit pattern. That lets you see, for example, that the 8-bit pattern 11111111 is 255 unsigned and -1 signed at the same time.
Does the calculator send my values anywhere?
No. All parsing, base conversion, and bitwise math run locally in your browser using JavaScript BigInt. Nothing is uploaded, logged, or sent to a server, so it is safe to work with register dumps, key material, or device identifiers.
What happens when a value exceeds the selected width?
Inputs and results are masked to the chosen width (8, 16, 32, or 64 bits). If you enter a number larger than the width can hold, the high bits are discarded — exactly as they would be when written to a register of that size — and the tool flags that the value was truncated so the wrap-around is never silent.
Byte Offset Calculator
Paste hex bytes and read them back as an indexed offset table — decimal and hex offsets, selectable grouping, and a printable-ASCII preview. Then pick any slice and see its unsigned and signed value in both little-endian and big-endian. Built for APDU, TLV, and binary-protocol debugging.
How to use this tool
What it does
Maps byte offsets within a hex buffer, with a printable-ASCII preview, so you can slice a field by position.
When to use it
Use it when a spec describes a structure by offset and length and you need to pull the right bytes out of a capture.
Worked example
Select offset 4, length 8 in a buffer to isolate an 8-byte serial number and see its ASCII rendering.
Input
Offset table
Interpret a slice as an integer
Integer value
What this tool does
A byte offset calculator answers the question every protocol engineer keeps asking while staring at a hex dump: which byte is at which position, and what does this run of bytes mean as a number? Paste a string of hex, and the tool produces a row-by-row table that pairs each group of bytes with its starting offset shown three ways — 0-based decimal, 0-based hexadecimal, and 1-based decimal — alongside a printable-ASCII rendering where any byte outside 0x20–0x7E appears as a dot. The total byte count is shown so you can confirm a length field at a glance.
Below the table, a second panel takes a start offset and a length and decodes that slice as an integer. It reports the unsigned value and the two's-complement signed value in both byte orders, using exact 64-bit arithmetic. Together the two panels turn a wall of hex into something you can navigate by position and read as values.
When to use it
Reach for it whenever you are debugging a length-prefixed or position-addressed binary structure. Typical cases: locating the Lc field and command data in an ISO 7816 APDU; confirming a two-byte SW1 SW2 status word; checking where a tag, length, and value sit inside a BER-TLV record; or reading a multi-byte counter or serial number out of a memory dump or NFC frame. Because grouping is selectable from 1 up to 16 bytes per row, you can line the view up with a 16-column hex editor or collapse it to one byte per row for fine-grained counting.
Input and output
The input is forgiving: it strips spaces, newlines, 0x prefixes, and : , ; separators before parsing, so traces copied from a card reader, a debugger, or a spec all work. The cleaned text must have an even number of hex digits and contain only 0–9 and a–f; anything else raises a specific inline error rather than guessing. The offset table output is plain monospaced text you can copy straight into a bug report. The integer panel echoes the exact slice it read, then the big-endian and little-endian values, so there is never ambiguity about which bytes produced which number.
Common mistakes
- Mixing up 0-based and 1-based offsets. Specs disagree; the table shows both, so quote the one your reference uses instead of converting in your head.
- Reading the wrong byte order. Smart-card and EMV fields are overwhelmingly big-endian, but many host-side and Intel-derived structures are little-endian. Check both — the panel always shows the pair.
- Forgetting the sign. A leading byte of
0x80or higher flips a signed interpretation negative. If a value looks impossibly large, read the signed column. - Slicing past the end. Asking for more bytes than remain raises an error rather than padding with zeros, so a bad length field is caught immediately.
- Pasting an odd number of digits. A dropped nibble shifts every byte after it; the even-length check stops that silently corrupting the table.
Related tools
TLV parser
Break a BER-TLV blob into tag, length, and value to see the structure behind the offsets.
Endianness converter
Flip byte order and view integers across widths in more detail.
Frequently asked questions
What input does the byte offset calculator accept?
Paste hex bytes in almost any common shape. Spaces, line breaks, 0x prefixes, colons, commas, and semicolons are all stripped before parsing, so 00A40400, 00 A4 04 00, and 00:A4:04:00 are equivalent. The cleaned string must contain an even number of hex digits; an odd count or a non-hex character produces a clear inline error.
Why does the table show both decimal and hex offsets?
Protocol specifications mix conventions. ISO 7816 and EMV tables usually count fields in decimal, while memory dumps and TLV traces label positions in hex. Showing 0-based decimal, hex, and 1-based decimal offsets side by side lets you match whichever the spec you are reading uses, without re-counting by hand.
How are the little-endian and big-endian integers computed?
You choose a start offset and a length of 1 to 8 bytes. The tool reads that slice most-significant-byte-first for big-endian and least-significant-byte-first for little-endian, then reports both the unsigned value and the two's-complement signed value. It uses JavaScript BigInt so 64-bit values stay exact rather than losing precision.
Does anything I paste leave my browser?
No. Parsing, the offset table, the ASCII preview, and all integer interpretation run locally in JavaScript on this page. Nothing is uploaded, logged, or sent to a server, so it is safe to inspect APDUs, keys, and other sensitive byte strings.
How do I use an offset table to locate a field in an APDU response?
Read the field's documented offset, then find that row in the table. The decimal and hex columns let you match specifications that use either notation without converting by hand.
Checksum calculator for byte strings
Compute every common non-cryptographic checksum over the same input at once: 8/16/32-bit sums, one’s- and two’s-complement, XOR (LRC), Fletcher-16/32, Adler-32, and the Internet checksum (RFC 1071). Feed it text, hex, or binary, toggle endianness for the word sums, and read the result in hex, decimal, or binary.
How to use this tool
What it does
Computes common checksums over input bytes for quick integrity comparison.
When to use it
Use it to confirm a payload matches an expected value or to reproduce a checksum a device reports.
Worked example
Paste a record and compare its checksum against the value printed by your reader.
Input
Result
What this tool does
A checksum condenses a block of bytes into a short fixed-width value so a reader can tell whether the block arrived intact. This calculator runs ten of the most widely used non-cryptographic checksums over the same input and shows every result side by side, which is exactly what you want when you are reverse-engineering an undocumented frame format and do not yet know which algorithm a device uses. Paste the payload, then scan the column for the value that matches the trailer byte already in the message.
The families covered are: plain additive sums truncated to 8, 16, or 32 bits; the one’s-complement and two’s-complement variants of the 8-bit sum; the XOR checksum (the same longitudinal redundancy check, or LRC, used in many serial and smart-card protocols); the position-sensitive Fletcher-16 and Fletcher-32; Adler-32 as used by zlib; and the 16-bit one’s-complement Internet checksum specified in RFC 1071 and carried in IP, TCP, UDP, and ICMP headers.
When to use it
Reach for this tool when you are validating or forging a trailer on a protocol frame, debugging a firmware update that a bootloader rejects with a “bad checksum” error, or confirming that a zlib/PNG stream’s Adler-32 matches. It is also handy for teaching: changing one byte of the input and watching which checksums move (and which collide) makes the error-detection trade-offs concrete. For polynomial CRCs see the dedicated CRC and LRC utilities in the resource library; for the byte-level views you will pair this with, see the encoding tools below.
Input and output
The Input is selector controls how your text is turned into bytes. Text (UTF-8) encodes the characters as UTF-8. Hex bytes accepts pairs of hex digits with optional spaces, commas, colons, or 0x prefixes. Binary bits accepts a run of 0/1 whose length is a multiple of eight. The Word order toggle only affects the 16-bit and 32-bit additive sums, because those are the only algorithms here that group bytes into multi-byte words before adding; all the others are defined byte-by-byte or on a fixed order. The Show as selector renders each result in hex (zero-padded to the algorithm’s width), decimal, or grouped binary. The Copy button exports every row as tab-separated label value lines.
Common mistakes
- Treating a checksum as security. Sum, XOR, Fletcher, Adler-32, and the Internet checksum all detect accidental corruption only; an attacker can trivially adjust bytes to hit any target. Use a hash or a keyed MAC for tamper resistance.
- Wrong endianness on word sums. A 16-bit or 32-bit sum that is “almost right” is usually a little-endian/big-endian mix-up — flip the toggle before assuming the spec is wrong.
- Forgetting the seed. Adler-32 starts from
1(not0) and Fletcher accumulators start from0; an implementation that seeds them differently will never match. - Including or excluding the wrong bytes. Many protocols checksum only part of a frame (often skipping the checksum field itself). Trim your input to the exact covered range.
- Odd-length input for 16-bit algorithms. The Internet and 16-bit sums conventionally pad a trailing odd byte with a zero; this tool does that, but a peer that pads differently will disagree.
Related tools
Frequently asked questions
Which checksum should I use to detect errors?
It depends on the threat. A plain 8-bit additive sum or XOR (LRC) catches single-bit and most burst errors and is trivial to compute on tiny micro-controllers, but it misses reordering and pairs of cancelling errors. Fletcher-16/32 and Adler-32 add a positional component so byte transpositions are detected, at very low cost. For Internet protocols the RFC 1071 16-bit one's-complement checksum is standard. None of these are cryptographic — for tamper resistance use a hash or a keyed MAC, not a checksum.
What is the difference between a one's-complement and two's-complement checksum?
Both are derived from the simple byte sum. The one's-complement checksum is the bitwise NOT of the truncated sum, so the sum plus the checksum equals all-ones. The two's-complement checksum is the arithmetic negation of the sum, so the sum plus the checksum wraps to zero — appending it makes the total of all bytes equal zero, which is convenient for verification. This tool reports both over an 8-bit accumulator.
Why does endianness matter for the 16-bit and 32-bit sums?
When bytes are grouped into 16-bit or 32-bit words before adding, the byte order inside each word changes the numeric value of every word and therefore the sum. Little-endian and big-endian grouping give different results for the same bytes. The 8-bit sum, XOR, Fletcher, Adler-32, and the Internet checksum are defined byte-by-byte or on a fixed word order, so the endian toggle does not change them; it only affects the 16-bit and 32-bit additive sums.
Are these checksums safe against deliberate tampering?
No. Sum, XOR, Fletcher, Adler-32, and the Internet checksum are integrity checks for accidental corruption only. An attacker can append or adjust bytes to force any target value, so they provide no authentication. For tamper detection use a cryptographic hash such as SHA-256, and for authenticity use a keyed MAC such as HMAC or CMAC verified by a secure element.
Does any of my data leave the browser?
No. Every checksum on this page is computed locally in JavaScript. Nothing you type or paste is uploaded, logged, or sent to a server, so it is safe to checksum sensitive payloads, firmware images, or APDU scripts.
CRC calculator with common polynomials
Compute a cyclic redundancy check over text, hex, or binary input using 70+ catalogue presets (CRC-8/16/32/64, CCITT, XMODEM, MODBUS, CRC-32C and more) or a fully custom width, polynomial, init, reflection, and xorout. The engine verifies each preset against its documented check value.
How to use this tool
What it does
Computes CRC values across common polynomials (CRC-16, CRC-32 and variants).
When to use it
Use it when a frame carries a CRC and you need to verify or reproduce it for a specific polynomial.
Worked example
Select CRC-16/CCITT and compute the FCS over a frame body to check it against the trailer.
Input
Result
What a CRC calculator is for
A cyclic redundancy check is an error-detecting code computed by treating your message as the coefficients of a polynomial and taking the remainder after dividing by a fixed generator polynomial. The remainder — the CRC — is appended to the data so a receiver can recompute it and detect transmission or storage errors. CRCs are everywhere in embedded and protocol work: Ethernet frames, USB packets, MODBUS RTU, CAN bus, ZIP/gzip archives, ISO 7816 smart-card transport, and countless proprietary radio and sensor frames.
The catch is that "CRC-16" or "CRC-32" alone does not pin down a value. A CRC variant is defined by six parameters — width, polynomial, initial value, input reflection, output reflection, and a final XOR — and changing any one of them yields a different result for the same bytes. This tool implements one generic bit-by-bit engine, parameterised by those six values and using BigInt internally, so widths from 3 to 64 bits all behave identically and correctly. It ships with 70+ named presets drawn from Greg Cook's well-known reveng catalogue, plus a fully custom mode.
When to use it
Reach for this tool when you are reverse-engineering or implementing a protocol and need to confirm exactly which CRC variant a device uses, when a checksum you computed in one language does not match another stack, or when you are validating firmware that appends a CRC trailer. Selecting a preset immediately recomputes that preset's documented check value — the CRC of the ASCII string 123456789 — and shows a pass/fail badge comparing the computed result against the catalogue figure, so you can trust the engine before trusting any other output. For a plain additive or XOR integrity byte instead of a polynomial CRC, the sibling LRC calculator and checksum tool are the right fit.
Input and output
Choose how your message is interpreted: Text is UTF-8 encoded to bytes; Hex bytes accepts pairs of hex digits with optional spaces, colons, or 0x prefixes; Binary bits accepts 0/1 in groups totalling a whole number of bytes. The result panel reports the byte count and the final CRC in three forms — hexadecimal (zero-padded to the register width), decimal, and binary — and the Copy button copies the hex value. Each render also prints the active six parameters so the result is self-documenting.
Presets
70+ named variants across widths 3–64: CRC-8 family, CCITT-FALSE, XMODEM, KERMIT, MODBUS, USB, X-25, CRC-32, CRC-32C, BZIP2, MPEG-2, the CRC-64 set, and more.
Custom mode
Set width, polynomial, init, RefIn, RefOut, and xorout by hand to match an undocumented device. The same engine runs, so results are consistent with the presets.
Check verification
Every preset's CRC of 123456789 is recomputed live and compared to the documented value, giving you a green pass badge before you rely on the tool.
Common mistakes
- Quoting only the polynomial. Two variants can share a polynomial and still differ by reflection or final XOR. Always nail down all six parameters when reproducing a value elsewhere.
- Reflected vs normal polynomial form. Presets here use the normal (non-reflected, MSB-first) polynomial. If a datasheet lists the reversed form (for example
0xEDB88320for CRC-32), do not type it directly — use the normal form0x04C11DB7and the RefIn/RefOut flags instead. - Hashing the wrong bytes. Decide whether the CRC should cover the header, the payload, or both, and whether the existing trailer bytes are included. Feeding the wrong span is the most common cause of a "wrong" CRC.
- Treating a CRC as cryptographic. CRCs detect accidental errors, not tampering. An attacker can adjust data to keep any CRC intact. For authentication use a MAC such as CMAC instead.
- Endianness of the appended CRC. The CRC value here is a number; how a protocol serialises it (big- or little-endian) is separate. Check the endianness tool when laying the bytes into a frame.
Related tools
LRC calculator
Longitudinal redundancy check — the XOR/sum integrity byte used in many serial protocols.
More utilities
Parsers, decoders, and references for smart-card, protocol, and FIDO engineers.
Frequently asked questions
What do width, poly, init, refin, refout and xorout mean?
These six parameters fully define a CRC variant (the Rocksoft / reveng model). Width is the size of the CRC register in bits. Poly is the generator polynomial in normal (non-reflected) form. Init is the starting value of the register. RefIn reflects each input byte before it is processed, and RefOut reflects the final register. Xorout is XORed into the result at the very end. Two CRCs with the same polynomial but different reflection or xorout produce completely different values.
What is the check value and why verify it?
The check value is the CRC of the nine ASCII bytes "123456789" under a given parameter set, as published in Greg Cook's catalogue. It is a fingerprint for a CRC definition. When you pick a preset this tool recomputes that value with its own engine and shows a pass or fail badge, so you can confirm the implementation and the parameters match the documented algorithm before trusting any other result.
Why does CRC-32 of the same data differ between two libraries?
Almost always because of reflection or final XOR, not the polynomial. The common zlib CRC-32 reflects input and output and XORs the result with all ones; CRC-32/BZIP2 uses the same polynomial but does not reflect; CRC-32/MPEG-2 drops the final XOR. Always pin down all six parameters, not just the polynomial, when reproducing a value from another stack.
Can this tool handle non-standard widths like CRC-5 or CRC-24?
Yes. The engine is a generic bit-by-bit implementation using BigInt, so any width from 3 to 64 bits works, including CRC-3/GSM, CRC-5/USB, CRC-7/MMC, CRC-15/CAN, CRC-24 and the 64-bit variants. Pick a preset or switch to custom mode and set the width, polynomial, init, reflection flags and xorout yourself.
Does any of my input leave the browser?
No. The CRC is computed entirely in JavaScript on this page. Nothing you type as text, hex, or binary is uploaded, logged, or sent to a server, so it is safe for proprietary frame layouts and firmware payloads.
Endian converter for byte order
Take a hex stream, group it by chosen width (u16 / u32 / u64), and see big-endian and little-endian renderings side by side, plus the unsigned numeric value of each. Crucial when reading length fields, TLV lengths, or numeric IDs in mixed-endian protocol stacks.
How to use this tool
What it does
Groups a hex stream by width (u16/u32/u64) and renders big-endian and little-endian side by side, with the unsigned value of each word.
When to use it
Use it when a field looks byte-swapped — reading a little-endian length or counter from a protocol that mixes byte orders, or reconciling host and network order.
Worked example
Paste 0A0B0C0D as u32: big-endian reads 0x0A0B0C0D, little-endian reads 0x0D0C0B0A.
Input
Result
About endianness
Big-endian writes the most-significant byte first. Little-endian writes the least-significant byte first. Smart-card / banking / network protocols typically use BE; x86, ARM, and most file formats use LE. Mixing them is a common source of bugs.
Spec
RFC 1700 (legacy network byte order).
Frequently asked questions
What is the difference between big and little endian?
Byte order within a multi-byte integer. Big-endian stores the most significant byte first, which is how network protocols and most card specifications write values; little-endian reverses it, which is what x86 and ARM use in memory.
Which order do smart-card specifications use?
Big-endian almost universally — ISO 7816, EMV and ASN.1 all write the most significant byte first. DESFire is the notable exception, using little-endian for several of its native fields.
Does endianness affect a byte array?
No. It only matters when a sequence of bytes is interpreted as a number. A hash, a key or a certificate is a byte string and must never be byte-swapped.
Why does my value look wrong by orders of magnitude?
Almost always the wrong width rather than the wrong order — reading a u16 as a u32 pulls in two adjacent bytes. Check the field length before suspecting endianness.
Does anything I paste leave my browser?
Nothing. The tool is entirely client-side: the page ships a static script, does no network calls, and never transmits what you paste. You can confirm it by opening the network tab, or by loading the page and then going offline.
HEX ↔ Byte-Array
Paste hex in any reasonable form (0x90, 0x00, 9000, 90:00, \\x90\\x00). Get back the same bytes formatted for C, Java, Python, JavaScript, escape-string, or canonical hex with your choice of separator.
Input
Result
What does this tool do?
Logs from PC/SC, Wireshark, gpshell, OpenSC, etc. all use slightly different hex formats. This tool normalises and re-emits in the format your code expects.
Formatting and counting hex bytes
Hex strings turn up everywhere in smart-card and crypto work — keys, APDUs, TLV payloads, hashes — but they arrive in inconsistent shapes: run-together, space-separated, comma-separated, or 0x-prefixed. This tool normalises a hex string into clean byte pairs, counts the bytes, and re-formats it the way your next tool expects.
Worked example: 0A0B0C is three bytes and formats to 0A 0B 0C. A valid hex byte string must have an even number of hex digits — an odd length (for example 0A0) is ambiguous and is rejected, which usually means a digit was dropped when copying.
Frequently asked questions
Why does an odd number of hex digits fail?
Each byte is exactly two hex digits, so a valid byte string is always even-length. An odd count means a digit is missing — recheck the source.
What byte count should I expect for a key or hash?
A SHA-256 value is 32 bytes (64 hex chars); an AES-128 key is 16 bytes. The byte counter helps confirm you pasted the whole value.
Does anything leave my browser?
No. Formatting and counting happen locally.
Why does my byte array show negative numbers in Java?
Java's byte type is signed, so any value above 0x7F appears negative. The underlying byte is unchanged; only the display differs, which is why 0xFF reads as -1.
Does byte order matter when converting hex to an array?
Not for the conversion itself, which preserves the sequence exactly. It matters when those bytes are interpreted as a number, where little-endian and big-endian give different results from the same array.
JSON Bin Builder and Validator
Create and manage local JSON bins in your browser. Validate, format, minify, and save JSON locally — useful for preparing demo payloads, static-site data, configuration examples, and API test samples. This tool does not upload your JSON to AmbiSecure servers; everything runs in your browser.
How to use this tool
What it does
Builds a binary blob from a JSON description of fields, entirely in the browser.
When to use it
Use it to assemble a test frame or record from a structured field list without writing a one-off script.
Worked example
Describe a small TLV as JSON and export the assembled bytes.
JSON
Result
JSON Schema (optional)
Local JSON bins
Local browser storage only. Saved bins live in this browser’s localStorage — they are never uploaded, and clearing your browser storage may delete them.
- No saved bins yet.
What this tool does
A browser-only JSON helper. Paste or create JSON, then validate its syntax, format it into readable JSON, or minify it into a compact single line. Save named JSON bins in local browser storage, then reopen, duplicate, and delete them. It is built for preparing JSON payloads for API testing, static-site data files, demo apps, and configuration examples — before you paste them into another system.
Local storage behavior
This is a static-site tool. Your JSON is processed entirely in the browser. Saved bins are stored only in this browser’s local storage — the tool does not create public API endpoints, does not generate fetchable URLs, and does not upload JSON to AmbiSecure. Clearing your browser storage (or using a private window) may delete saved bins.
Common use cases
API & demos
API payload testing, demo-app data, and developer-handoff samples you want to format and sanity-check first.
Static-site data
Prepare JSON data files, FAQ/resource-list JSON, and configuration examples for a static build.
Pre-flight checks
Validate and tidy JSON before pasting it into another system, a config store, or a code review.
What not to put here
This is a convenience tool, not a vault. Do not paste or store:
- Passwords
- API keys
- Access tokens
- Private customer data
- Regulated data
- Production secrets
- Production security-sensitive configuration
Security note
Browser-local tools are handy for everyday convenience, but local browser storage is not a secure vault: shared or managed computers, browser extensions, and synced profiles can all expose local data. Production systems that handle real data need authentication, authorization, expiry, access controls, logging, secure hosting, and data classification — none of which a client-side helper provides.
For context: token-bearing URLs from JSON-bin–style hosted systems are convenient but are not equivalent to strong authentication — anyone with the URL can read the data. This static AmbiSecure version sidesteps that risk entirely because it does not create token URLs or any server-side endpoint; nothing leaves your browser.
Companion tools
More utilities
Attribution
This tool is based on the open-source GitHub project by Alex Zirbel.
Frequently asked questions
What does this tool store and where?
Bins are held in your browser's local storage. Nothing is uploaded, and clearing site data removes them permanently — there is no server-side copy to recover.
Why does my JSON fail to validate?
Usually trailing commas, single quotes, unquoted keys, or a byte-order mark at the start. All are valid JavaScript habits that strict JSON rejects.
What is the difference between formatting and minifying?
Formatting adds indentation for reading; minifying strips all insignificant whitespace for transport. Neither changes the parsed value.
Is this suitable for production data?
No. It is a scratchpad for API testing, demos and configuration examples. Anything that matters belongs in version control.
Does anything I paste leave my browser?
Nothing. The tool is entirely client-side: the page ships a static script, does no network calls, and never transmits what you paste. You can confirm it by opening the network tab, or by loading the page and then going offline.
Length-field encoder for BER-TLV
Convert an integer length into the binary length field used by various protocols: BER long-form (X.690), GP DGI long-form, plain u8, and u16 in big-endian and little-endian. The right format the first time saves a lot of debugging.
How to use this tool
What it does
Converts an integer length into the binary length field used by BER long-form (X.690), GlobalPlatform DGI long-form, and plain u8/u16 in both byte orders.
When to use it
Use it when hand-building a TLV or DGI structure and you need the exact length prefix bytes for a value, rather than guessing the long-form encoding.
Worked example
Enter 300 and BER long-form renders 82 01 2C (two length bytes flagged by 0x82).
Input
Result
BER vs DGI vs raw
BER (X.690) length: short form when ≤ 127; long form is 0x80|N followed by N length bytes. DGI (GlobalPlatform Data Group Identifier) length: short when < 0xFF; long form is 0xFF followed by 2 length bytes. Raw u8/u16 just write the value at the chosen width.
Spec
X.690 (BER lengths) and GP Card Specification 2.3.1 (DGI).
Next step
ASN.1 encoding rules reference for where each length form is allowed.
Frequently asked questions
Why are there several length encodings?
Because different layers chose differently. BER uses short and long form, DGI uses its own long form, and many proprietary protocols just use a fixed one- or two-byte field.
What is DGI long form?
A Data Grouping Identifier convention where a length of 255 or more is written as 0xFF followed by two big-endian bytes. It appears throughout card personalisation payloads.
When do I need two bytes rather than one?
As soon as the value can reach 256. Sizing a field to the maximum the specification allows rather than to today's data is what prevents a silent truncation later.
Does byte order matter for a length field?
Yes, and it is protocol-specific. BER and DGI are big-endian; several proprietary formats are little-endian, which is why this tool shows both.
Does anything I paste leave my browser?
Nothing. The tool is entirely client-side: the page ships a static script, does no network calls, and never transmits what you paste. You can confirm it by opening the network tab, or by loading the page and then going offline.
LRC calculator for ISO 7816
Compute a longitudinal redundancy check over text or hex bytes: XOR parity, 8-bit and 16-bit additive two’s-complement and modulo sums, with optional STX/ETX framing and a step-by-step running-accumulator table.
How to use this tool
What it does
Computes the longitudinal redundancy check (XOR of all bytes) used by several card and terminal protocols.
When to use it
Use it when a message ends in an LRC byte and you need to validate or generate it.
Worked example
XOR every byte of a command to derive its trailing LRC.
Input
Result
What an LRC is for
A longitudinal redundancy check (LRC) is one of the oldest and simplest block-check values in data communications. You combine every byte of a message into a single one- or two-byte result, append it to the frame, and let the receiver recompute the same value. If the two disagree, the frame is corrupt and gets rejected or retransmitted. The name "longitudinal" comes from the original tape and teleprinter use: where a parity bit checks one character vertically, the LRC checks a whole column of characters lengthwise down the message.
The classic LRC is a byte-wise XOR of every covered byte — a longitudinal parity that flips with any single-bit change in a column. A second family is additive: sum the bytes and keep either the raw sum modulo 256 (or 65536), or its two’s-complement. The two’s-complement form is popular because adding it back into the running sum drives the total to zero, so a verifier just sums the data and the LRC and checks for a clean zero result.
When to use it
Reach for an LRC when a wire protocol explicitly specifies one. The XOR form appears in many proprietary serial links, point-of-sale terminals, and barcode framing. The two’s-complement additive form is the block check in ISO 8583-style financial messaging and in Modbus ASCII, where each frame ends with an LRC computed over the address, function, and data fields. If your protocol instead calls for polynomial integrity, you want a CRC, not an LRC — for example Modbus RTU uses a 16-bit CRC while Modbus ASCII uses this LRC. Use this tool to confirm a captured frame’s trailing byte, to generate the check value when hand-building a test frame, or to settle which bytes a vendor’s spec actually covers.
Input and output
Paste the message body as ASCII / UTF-8 text or as hex bytes (spaces, commas, colons and a leading 0x are ignored). Pick a variant, then toggle whether the leading STX (0x02) and trailing ETX (0x03) framing bytes are included in the computation — protocols differ, and this is the most common source of mismatches. The result panel shows the LRC in hexadecimal and decimal, the exact list of bytes that were processed, and a running-accumulator table listing each offset, byte value, printable character, and the accumulator after that step. For long inputs the table is capped to keep the page responsive; the final value is always exact.
Common mistakes
- Including or excluding the wrong framing bytes. Whether
STXandETXare inside the LRC varies by spec. Toggle them here to match your protocol exactly. - Confusing modulo sum with two’s-complement. The modulo-256 sum and its two’s-complement differ by negation; picking the wrong one yields a value that looks plausible but never verifies.
- Treating hex input as text. The string
3132is two bytes in hex mode but four characters in text mode. Set the input type before reading the result. - Expecting CRC-grade detection. An LRC misses many multi-bit and transposition errors. For burst-error resilience use a CRC instead.
- Width confusion. An 8-bit LRC is one byte; the 16-bit variants emit two bytes. Send the bytes in the order your protocol expects.
Related tools
ASCII ↔ HEX
Convert between printable text and byte values before computing an LRC.
More utilities
Parsers, decoders, and integrity tools for smart-card and protocol engineers.
Frequently asked questions
What is a longitudinal redundancy check (LRC)?
An LRC is a one- or two-byte block check value computed by combining every byte of a message, traditionally with a column-wise XOR (longitudinal parity) or with an additive sum. The sender appends the LRC and the receiver recomputes it; a mismatch flags a transmission error. It is a lightweight integrity check, not a cryptographic one, and it cannot detect every error pattern.
How is a two’s-complement LRC calculated?
Add every covered byte modulo 256 to get a running sum, then take the two’s-complement: LRC = (256 − (sum & 0xFF)) & 0xFF. The useful property is that the sum of all message bytes plus the LRC byte equals zero modulo 256, so a receiver can simply add everything including the LRC and check for a zero result. The 16-bit variant uses 65536 in place of 256.
Should STX and ETX be included in the LRC?
It depends on the protocol. Many ISO 8583 and serial framings compute the LRC over the data field plus the trailing ETX (0x03) but exclude the leading STX (0x02); others cover neither or both. There is no universal rule, so check your specification. This tool lets you toggle STX and ETX independently so you can match the exact bytes your protocol covers.
Is an LRC the same as a CRC or a checksum?
No. An LRC is a simple parity or additive block check. A CRC uses polynomial division and catches far more error patterns, including most burst errors, which is why protocols such as Modbus RTU use a CRC while Modbus ASCII uses an LRC. A general checksum may use any of these schemes. Pick the one your wire format mandates.
Does anything I paste leave my browser?
No. All LRC computation runs locally in JavaScript on this page. Nothing is uploaded, logged, or sent to a server, so it is safe to paste frame captures or protocol payloads while debugging.
SHA Hash Generator
Compute SHA-1, SHA-256, SHA-384, and SHA-512 digests of text, hex bytes, or a local file using the browser’s crypto.subtle.digest. Each digest is shown as lowercase hex and standard Base64, with copy buttons.
How to use this tool
What it does
Computes SHA-1, SHA-256, SHA-384 and SHA-512 digests of input text or hex.
When to use it
Use it to reproduce a fingerprint, verify a hash a system reports, or hash a challenge during protocol work.
Worked example
Hash the string test with SHA-256 and compare the digest to an expected value.
Input
Digests
What this SHA hash generator does
A cryptographic hash function maps any amount of input to a fixed-length digest that is practically impossible to reverse and, for a strong algorithm, infeasible to collide. This page computes the digest of whatever you type, paste as hex, or load from a local file, and renders it in two encodings: lowercase hexadecimal (the form printed by sha256sum and most command-line tooling) and standard Base64 (the form used in Subresource Integrity attributes, JWT thumbprints, and many certificate fingerprints).
Everything is computed with the browser’s built-in crypto.subtle.digest. There is no hand-rolled hashing JavaScript here — the bytes you see are exactly what the platform’s vetted Web Crypto implementation returns, identical to what any other application on the machine would compute. Because crypto.subtle is asynchronous, the page awaits each digest before displaying it.
When to use it
Reach for this tool when you need to verify a download against a published checksum, confirm two files are byte-identical, derive an SRI integrity value for a script tag, sanity-check a fingerprint your code produced, or learn how the four SHA-2 lengths differ. It pairs naturally with the certificate fingerprint tool when you are matching a thumbprint, and with the Base64 tool when you need to convert a digest between encodings.
Input and output
Choose how your input is interpreted. Text (UTF-8) encodes the characters you type as UTF-8 bytes before hashing. Hex bytes treats the input as raw bytes — useful when you already have a key or message in hex; separators, 0x prefixes, and whitespace are ignored, but the digit count must be even. The file button hashes the exact bytes of a local file and shows its name and size; an empty input still produces the well-known digest of the empty string.
For each selected algorithm the result panel lists the digest length in bits, the lowercase hex form, and the standard Base64 form, each with its own copy control. Choose “All four digests” to compare lengths side by side, or pick a single algorithm to focus on one value.
Supported and unsupported algorithms
Web Crypto’s SubtleCrypto.digest defines only four digests, and those are the only four offered here:
SHA-256 / 384 / 512
The SHA-2 family. SHA-256 is the modern default; SHA-384 and SHA-512 give longer digests for higher security margins.
SHA-1 (legacy)
160-bit and broken for collision resistance (SHAttered, 2017). Provided only to verify legacy values — never design new security around it.
Not available
SHA-224, SHA-512/224, SHA-512/256 and the entire SHA-3 / Keccak / SHAKE family are not in Web Crypto. We omit them rather than ship unverified crypto.
Common mistakes
- Hashing the wrong bytes. Leaving the mode on “Text” when your value is hex (or vice versa) produces a completely different digest. Pick the mode that matches your data.
- Trusting SHA-1. Matching a SHA-1 value to verify an old artifact is fine; using SHA-1 for a new signature, integrity check, or password scheme is not.
- Comparing across encodings. A hex digest and a Base64 digest of the same input look totally different but encode the same bytes — compare like with like.
- Expecting SHA-3 or SHA-224. They are intentionally absent because the browser cannot compute them; this tool will not fake them.
- Odd-length hex. Hex input must have an even number of digits, since each byte is two hex characters.
Related tools
Certificate fingerprint
Compute SHA-1/256 fingerprints of an X.509 certificate.
Frequently asked questions
Which SHA algorithms does this tool support?
Exactly the four digests the browser’s Web Crypto API natively implements: SHA-1, SHA-256, SHA-384 and SHA-512. The tool runs crypto.subtle.digest for each, so the output is the same bytes the platform would produce in any other Web Crypto call. It does not implement any algorithm in hand-written JavaScript.
Why are SHA-224, SHA-512/256 and SHA-3 not offered?
The WebCrypto SubtleCrypto.digest method only defines SHA-1, SHA-256, SHA-384 and SHA-512. SHA-224, the truncated SHA-512/224 and SHA-512/256 variants, and the entire SHA-3 / Keccak / SHAKE family are not available in the browser. Rather than ship an unverified pure-JavaScript implementation that could produce wrong digests, we intentionally omit them.
Is it safe to keep using SHA-1?
No, not for anything that relies on collision resistance. SHA-1 has practical collision attacks (SHAttered, 2017) and is forbidden for new digital signatures and certificates. It is included here only so you can verify or compare against legacy systems. Use SHA-256 or stronger for any new design.
What is the difference between the hex and Base64 output?
Both encode the identical digest bytes. Lowercase hex is the conventional form for checksums and command-line tools such as sha256sum. Standard Base64 is denser and shows up in Subresource Integrity attributes, certificate fingerprints and JWT thumbprints. Decode either back to the same raw bytes.
Does my input or file leave the browser?
No. The text, hex and any file you choose are read locally and hashed in memory with Web Crypto. Nothing is uploaded, logged, or sent to a server, so the tool is safe for sensitive content.