Encryption: Cipher, Algorithms and Keys
Encryption: Cipher, Algorithms and Keys
Encrypted
Data
Types of Cipher
● Historical
● Pen and Paper Ciphers ( Substitution Cipher)
● Machine Ciphers (Rotor machine, Enigma
Machine)
● Modern
● Symmetric/Private key (Stream, Block, etc.,)
● Asymmetric/Pubic key ( SSL, PKCS#1, etc.,)
Substitution Cipher
● A Substitution cipher is a method of encoding
by which units of plaintext are replaced with
cipher text, according to a regular system; the
"units" may be single letters (the most
common), pairs of letters, triplets of letters,
mixtures of the above, and so forth.
SIAA ZQ LKBA. VA ZOA
RFPBLUAOAR!
Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Ciphertext alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY
Cipher : Z Z Z J U C L U D T U N WG C Q S
Rotor Machine
● a Rotor machine is an electro-mechanical
stream cipher device used for encrypting and
decrypting secret messages.
A P E K
B E K S
C K S A
D S A X
. . . .
. . . .
Rotor
. . .
Machin .
. . .
e .
. . .
. . . .
X L T O
Y T O P
Z O P E
Enigma Machine
● An Enigma machine was used for the
encryption and decryption of secret messages.
Enigma was invented by the German engineer
Arthur Scherbius at the end of World War I.
The early models were used commercially
from the early 1920s, and adopted by military
and government services of several countries
— most notably by Nazi Germany before and
during World War II.
One Time Pad
● the One-Time Pad (OTP) is a type of
encryption which is impossible to crack if used
correctly. Each bit or character from the
plaintext is encrypted by a modular addition
with a bit or character from a secret random
key (or pad) of the same length as the
plaintext, resulting in a cipher text.
● If the key is truly random, as large as or
greater than the plaintext, never reused in
whole or part, and kept secret, the ciphertext
will be impossible to decrypt or break without
knowing the key.
One Time Pad
Message: T H E B R I T I S H A R E C O M I N G
Key : D K J F O I S J O G I J P A P D I G N
Cipher : W R N G F Q L R G N I A T C D P Q T T
Hashing
● A cryptographic hash function is a hash
function; that is, an algorithm that takes an
arbitrary block of data and returns a fixed-
size bit string, the (cryptographic) hash value,
such that any (accidental or intentional)
change to the data will (with very high
probability) change the hash value.
Properties
● Most cryptographic hash functions are
designed to take a string of any length as
input and produce a fixed-length hash value.
● Given a hash h it should be difficult to find
any message m such that h = hash(m).
● Given an input m1 it should be difficult to find
another input m2 such that m1 ≠ m2 and
hash(m1) = hash(m2).
● It should be difficult to find two different
messages m1 and m2 such that hash(m1) =
hash(m2).
SHA
● SHA stands for "secure hash algorithm“.
● Is a cryptographic hash function designed by
the United States National Security Agency
and published by the United States NIST as a
U.S. Federal Information Processing Standard.
● There are 4 versions/types in SHA (SHA – 0,
SHA – 1, SHA – 2, SHA – 3)
Output Internal
Algorithm and size state Max Word
Block size Operations
variant message size
(bits) (bits)
Collisions found?
SHA-0 Yes
SHA-1 160 160 512 264 − 1 32 add, and, or, xor, rotate, mod Theoretical attack (260)[6]
SHA-
256/224 256/224 256 512 264 − 1 32
SHA- add, and, or, xor, rotate, mod,
SHA-2 512/384 512/384 512 1024 2128 − 1 64 shift No
SHA
● SHA1("The quick brown fox jumps over the
lazy dog") = 2fd4e1c6 7a2d28fc ed849ee1
bb76e739 1b93eb12
● SHA1("")
= da39a3ee 5e6b4b0d 3255bfef 95601890
afd80709
MD5
● The MD5 message-digest algorithm is a
widely used cryptographic hash function that
produces a 128-bit (16-byte) hash value.
● MD5("The quick brown fox jumps over the
lazy dog") =
9e107d9d372bb6826bd81d3542a419d6
● MD5("The quick brown fox jumps over the
lazy dog.") =
e4d909c290d0fb1ca068ffaddf22cbd0
● MD5("")
= d41d8cd98f00b204e9800998ecf8427e
One-way function
● In computer science, a one-way function is a
function that is easy to compute on every
input, but hard to invert given the image of a
random input.
● A Password or passphrase is hashed using
multiple parameter and the encryption is
stored.
● Salt is one of the parameter generally used in
hashing. This is a random variable
used/generated during password storage.
Questions
Thank
You