From b1e2526fbb1659621ecbaf3368e8c2c9a56ff976 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 19 Sep 2019 00:12:58 -0700 Subject: [PATCH] writing things down to never see this class again --- 312/notes/ciphers.md | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 312/notes/ciphers.md diff --git a/312/notes/ciphers.md b/312/notes/ciphers.md new file mode 100644 index 0000000..49fa7b5 --- /dev/null +++ b/312/notes/ciphers.md @@ -0,0 +1,50 @@ +# Block Ciphers + +The main concept here is twofold : + +* we take _blocks_ of data and cipher the _blocks_ +* A given key is actually used to generate recursive keys to be further used on the data itself + + +_bs example ahead_ + +Say we have a key 7 and some data 123456. +We take the whole data set and chunk it into blocks(for example): 12 34 56. + +Let's say our function here is to just add 7 to each block so we do the first step: + +``` +12 + 7 = 19 +Unlike other ciphers we don't reuse 7; instead we use the new thing as both the new key and part of our cipher text + +19 + 34 = 53 +Cipher: 1953.. + +53 + 56 = 109 <= let's pretend that this rolls over 99 and back to 00 + 09 <= like this + +Final cipher: 195309 +``` + +_It should be noted that in practice these functions usually take in huge keys and blocks_. + +# Feistal Cipher + +Two main components: + +1. each _thing_ in the data to cipher is replaced by a _ciphered thing_ + +2. nothing is added or deleted or replaced in sequence, instead the order of _things_ is changed. + +Basically imagine that every _type of thing_ in our data maps to some other _type of thing/thing_ in the data and thus become swapped/reordered. + +# DES - Data Encryption Standard + +Widely used until about 2001 when AES surpassed it as the newer(ish(kinda)) standard. + +DEA was the actual algorithm tho: + +* 64 bit blocks +* 56 bit keys +* turns a 64-bit input into a 64-bit output (wew) +* Steps in reverse also reverse the encryption itself