Hexworth Prime House of Shield

Encryption Lab — ASCII ↔ Binary ↔ Hex • Diffie–Hellman • RSA

1) Input & Live Conversion

Type text to see how computers represent it at the byte level. Hover the 0x badges for tips.

Tip: Click Convert or press Ctrl/⌘+Enter.
ASCII (decimal)
Binary (8-bit)
Hexadecimal 0x

2) How Hex Works Each 4 bits (nibble) = 1 hex digit

Live nibble grouping▾

For each character, we split the 8-bit binary into two nibbles and map them to hex.

Hex Key Table ▾
DecimalBinary (4-bit)Hex

3) XOR Encryption (Interactive)

XOR is reversible: C = P XOR K and P = C XOR K. Try a one-character key first.

Same operation decrypts it because XOR is its own inverse.

Plaintext (Hex)
Key (Hex)
Ciphertext (Hex)
Show byte‑by‑byte steps▾

4) Diffie–Hellman Key Exchange (Interactive)

Two parties agree on a public prime p and generator g. They keep private secrets a and b, exchange public values, and derive the same shared key: K = g^{ab} mod p.

Alice public A = g^a mod p
Bob public B = g^b mod p
A = g^a mod p
B = g^b mod p
Shared key K
Alice computes K = B^a mod p; Bob computes K = A^b mod p — both match.

5) RSA (Interactive Mini‑Demo)

Choose small primes p and q to build n=p·q and φ=(p−1)(q−1), pick e coprime with φ, compute d ≡ e⁻¹ (mod φ), then encrypt/decrypt m with c=m^e mod n, m=c^d mod n.

For teaching only — small numbers, not secure.
n = p·q
φ = (p−1)(q−1)
Private d = e⁻¹ mod φ
Tip: Try 65 (letter 'A'). Multi‑char encoding is beyond this mini‑demo.
Cipher c = m^e mod n
Recovered m = c^d mod n
Show math steps▾
In real RSA, primes are hundreds of bits and messages are padded/encoded. This demo illustrates the number theory only.

6) Notes & Tips

  • ASCII vs Unicode: this app focuses on plain ASCII for clarity.
  • Uppercase and lowercase differ by one bit in ASCII (the 0x20 bit).
  • Two hex digits = one byte. Example: 0x41 = decimal 65 = 01000001.
  • DH and RSA sections are for demonstration — do not use these small numbers for real security.