Cryptography Basics

For CTF Competitions

By Collin Dewey

What is Cryptograhpy?

Secure Communication



What is a cipher?

How we get there

Common Different Representations of Text

Base Encoding ASCII Result Text Note
2 Binary Moon 01001101 01101111 01101111 01101110 Digits 0-1
8 Octal Magic 115 141 147 151 143 Digits 0-7
10 Decimal Sunset 83 117 110 115 101 116 Digits 0-9
16 Hex Elements 45 6C 65 6D 65 6E 74 73 Digits 0-9 and A-F
64 Base64 Celestial! Q2VsZXN0aWFsIQ== a-z, A-Z, 0-9. = or == as padding

There exist other representations such as Morse Code and Braille

Common Ciphers

Rail Fence Cipher

  • Requires number of "rails", with an optional offset
  • el hr,hwaeyuHloTee o r o

Atbash Cipher

  • Tllw, sld ziv blf?

Shift Cipher

  • J bn epjoh xfmm

Vigenere Cipher

  • Needs a key - "CTF"
  • Ihtf mt jxft, B'r ieff

ROT13

  • V ubarfgyl qba'g erzrzore jung V jebgr

Affine Cipher

  • Trrk ijhf ro gwn HGQ

Substitution Cipher

  • Replace a letter with another letter
  • quipquip

Other

Symbols

Other Symbols

  • Reverse Image Search

Logo on the right is for the Pigpen Cipher

Cryptography is an overarching field over trying to have secure and private communications, even in the presence of prying eyes.

The algorithm of how we get there.

There are multiple ways to represent text.

One of the most common ways for English is with the ASCII encoding, which all of the bellow examples are in.

ASCII is just a way to store our normal English language characters into data.

However, you can represent that data itself in different ways.

Binary, Octal, Decimal, Hexadecimal, and Base64

The data is still there, just represented to us differently. So I really wouldn't consider these a cipher

a:3 b:1

# Encryption RSA AES --- # Data Manipulation Bit Shifting/Rotation XOR

--- # Cryptography Tools <!-- Modern cryptographic methods are much more math oriented and complicated.

Most of them use some sort of key or certificate, and there are tools to manager those.

.PEM, .KEY, .CER, .P12, ... - OpenSSL