Add new visualizations
51
GCryptLib/visualizations/create-visualizations.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!zsh
|
||||
|
||||
echo "Make sure to have run all visualization scripts in!"
|
||||
echo "These generate the base images!"
|
||||
|
||||
# Copy all images over, but as pngs, and a bit larger
|
||||
find ../build/ -maxdepth 1 -type f -name '*.bmp' |\
|
||||
xargs -I {}\
|
||||
convert "{}"\
|
||||
-filter box\
|
||||
-resize 256x\
|
||||
"{}.png"
|
||||
|
||||
mv ../build/*.png .
|
||||
|
||||
# Create a few gifs
|
||||
|
||||
# Singleblock diffusion
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-singleblock-diffusion-input.bmp.png"\
|
||||
"visualize-singleblock-diffusion-input-flip.bmp.png"\
|
||||
"visualize-singleblock-diffusion-input.gif"
|
||||
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-singleblock-diffusion-output.bmp.png"\
|
||||
"visualize-singleblock-diffusion-output-flip.bmp.png"\
|
||||
"visualize-singleblock-diffusion-output.gif"
|
||||
|
||||
|
||||
# Multiblock diffusion
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-multiblock-diffusion-input.bmp.png"\
|
||||
"visualize-multiblock-diffusion-input-flip.bmp.png"\
|
||||
"visualize-multiblock-diffusion-input.gif"
|
||||
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-multiblock-diffusion-output.bmp.png"\
|
||||
"visualize-multiblock-diffusion-output-flip.bmp.png"\
|
||||
"visualize-multiblock-diffusion-output.gif"
|
||||
|
||||
# Extreme input diffusion
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-extreme-input-diffusion-input.bmp.png"\
|
||||
"visualize-extreme-input-diffusion-input-flip.bmp.png"\
|
||||
"visualize-extreme-input-diffusion-input.gif"
|
||||
|
||||
convert -delay 10 -loop 0 -dispose previous \
|
||||
"visualize-extreme-input-diffusion-output.bmp.png"\
|
||||
"visualize-extreme-input-diffusion-output-flip.bmp.png"\
|
||||
"visualize-extreme-input-diffusion-output.gif"
|
||||
|
Before Width: | Height: | Size: 938 B |
Before Width: | Height: | Size: 938 B |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 335 B |
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 908 B |
After Width: | Height: | Size: 314 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 445 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 444 B |
After Width: | Height: | Size: 450 B |
After Width: | Height: | Size: 441 B |
After Width: | Height: | Size: 3.6 KiB |
43
readme.md
@ -131,31 +131,30 @@ future output.
|
||||
#### Single-block diffusion
|
||||
`"Hello :3"` in binary, and it's ciphertext:
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Now, let's flip a single bit in the input:
|
||||
|
||||
One bit flipped, and again the corresponding ciphertext:
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Let's gif them together, to better see the difference:
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
As shown, flipping even a single bit, affects the entire ciphertext.
|
||||
|
||||
#### What about input longer than a single block?
|
||||
|
||||
Input, and ciphertext:
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Notice how the ciphertext doesn't change until the block containing the bitflip is reached? This is a limitation of cipher block chaining.
|
||||
|
||||
@ -163,14 +162,30 @@ Notice how the ciphertext doesn't change until the block containing the bitflip
|
||||
How non-transparent is the cipher with extreme inputs? Even with a super problematic key?:
|
||||
|
||||
Input, key, and ciphertext:
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
Notice how even cleartexts that are almost completely uniform, with a key that is just zeores, will produce ambiguous ciphertexts.
|
||||
I darkened the input gif, as to not cause disorientation by flickering.
|
||||
Notice how even cleartexts that are completely uniform, with a key that is almost just zeores, will still produce ambiguous ciphertexts.
|
||||
|
||||
### What about the PRNG's distribution?
|
||||
Check it out, here are the distributions of a few different getter-methods, some in black/white, some in grayscale, some in color.
|
||||
|
||||
Blackwhite - GetBit(), Grayscale - GetRandom<T>(), and Grayscale - operator():
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Color - GetRandom<T>(), Color - operator(), and Color - GetBlock():
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Noteworthy:
|
||||
* This is no fixed algorithm. Newer versions may very well be unable to decrypt ciphertexts encrypted with earlier versions.
|
||||
|