Hex to binary
Here's a hex to binary converter with a bold, retro-terminal aesthetic: import { useState, useCallback } from "react"; const HEX_CHARS = "0123456789ABCDEFabcdef"; function hexToBinary(hex) { const clean = hex.replace(/\s+/g, "").replace(/^0x/i, ""); if (!clean) return { binary: "", groups: [] }; const groups = []; for (const char of clean.toUpperCase()) { if (!HEX_CHARS.includes(char)) return { error: `Invalid hex character: '${char}'` }; const bin = parseInt(char, 16).toString(2).padStart(4, "0"); groups.push({ hex: char, bin }); } const binary = groups.map(g => g.bin).join(" "); return { binary, groups, clean }; } function binaryToHex(bin) { const clean = bin.replace(/\s+/g, ""); if (!clean) return { hex: "", groups: [] }; if (!/^[01]+$/.test(clean)) return { error: "Invalid binary: only 0s and 1s allowed" }; const pad...