0Pricing
Cryptology Academy · Lesson

Binary & Hexadecimal Fundamentals

Convert between decimal, binary, and hex with confidence.

Binary & Hexadecimal Fundamentals is a free Cryptology Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Welcome

Cryptography operates on bits and bytes. In this lesson we build fluency in binary and hexadecimal — the native languages of every encryption algorithm.

Why Binary?

Computers store everything as 0s and 1s. A bit is a single binary digit. A byte is 8 bits and holds values 0–255. All crypto operations happen at this level.

Binary to Decimal

Binary 1011 = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11 decimal. Each bit position is a power of two, starting from the rightmost bit (2⁰).

Decimal to Binary

Convert 42 to binary: 42÷2=21r0, 21÷2=10r1, 10÷2=5r0, 5÷2=2r1, 2÷2=1r0, 1÷2=0r1. Read remainders bottom-up: 101010.

Hexadecimal Basics

Hex uses 16 digits: 0–9 and A–F (A=10, B=11, ..., F=15). One hex digit represents 4 bits (a nibble). Two hex digits represent one byte.

Binary to Hex

Group binary into 4-bit nibbles from the right: 10111010 → 1011 1010 → B A → 0xBA Python: hex(0b10111010) → '0xba'

Hex in Cryptography

SHA-256 outputs 32 bytes displayed as 64 hex characters. AES-128 keys are 16 bytes = 32 hex chars. Hex is the universal display format for crypto values.

Python Conversions

bin(255) # '0b11111111' hex(255) # '0xff' int('ff', 16) # 255 bytes.fromhex('deadbeef') # b'\xde\xad\xbe\xef' 'deadbeef'.upper() # 'DEADBEEF'

Byte Ordering: Big vs Little Endian

Big-endian stores the most significant byte first. Little-endian stores the least significant first. Network protocols (TCP/IP) use big-endian; x86 CPUs use little-endian.

XOR Preview

XOR operates bit by bit: 0101 XOR 0011 = 0110. In hex: 0x05 XOR 0x03 = 0x06. XOR is the fundamental operation in AES, stream ciphers, and hash functions.

Common Crypto Values in Hex

Magic bytes identify file formats: PDF starts 0x25504446, PNG starts 0x89504E47. Cryptographic constants like the SHA-256 initialization values are specified in hex.

Quick Check

What is the decimal value of the hexadecimal number 0xFF?

Recap

Excellent! You can now convert between decimal, binary, and hex. Next we tackle modular arithmetic — the math engine of public-key cryptography.

Frequently asked questions

Is the “Binary & Hexadecimal Fundamentals” lesson free?

Yes — the full text of “Binary & Hexadecimal Fundamentals” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Binary & Hexadecimal Fundamentals”?

Convert between decimal, binary, and hex with confidence. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Binary & Hexadecimal Fundamentals” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Binary & Hexadecimal Fundamentals
  2. Modular Arithmetic Basics
  3. Prime Numbers & Factorization
  4. GCD, Euler's Totient & Number Theory Intro
← Back to Cryptology Academy