Aller au contenu
uencoder

Comment en Convertir Hex en Binary

Convertir hexadecimal strings to binary representation and understand the relationship between the two.

问题

You avoir un hex chaîne (e.g., de un hachage digest) et besoin its binary (0s et 1s) representation pour analyse ou low-niveau fonctionner.

Prérequis

  • Understanding of hexadecimal (base-16)
  • Understanding of binary (base-2)

Étapes

  1. 1. Split the hex into nibbles

    Each hex digit (nibble) corresponds to exactly 4 binary bits. Split the hex string into individual characters so you can map each one independently.

    entrée
    1A
    输出
    nibbles: 1, A
  2. 2. Map each nibble to 4 bits

    Convert each hex digit to its 4-bit binary equivalent: 1 → 0001, A → 1010. Concatenate the results. Do not drop leading zeros in any nibble.

    entrée
    1A
    输出
    00011010
  3. 3. Verify the result

    Group the binary output into bytes (8 bits) and confirm each byte matches the original hex pair. 1A in hex equals 26 in decimal, which equals 00011010 in binary.

    entrée
    00011010
    输出
    decimal: 26 ✓

Résultat attendu

Un binary chaîne où chaque hex digit expanded en exactly 4 bits, preserving leading zeros.

Erreurs courantes

Dropping leading zeros in the first nibble
Always pad each nibble to exactly 4 bits. The hex value 0F must become 00001111, not 1111.
Including the 0x prefix in the conversion
Strip the 0x prefix before converting. It is a notation marker, not part of the value.

Dépannage指引

  • If the binary length is not 4× the hex length, you dropped a leading zero.
  • Use a base converter tool to cross-check the result.

Limites de sécurité

  • This is a pure format conversion with no security implications.

Outils associés

Termes associés

参考链接