diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24b4c5a --- /dev/null +++ b/.gitignore @@ -0,0 +1,67 @@ + +# Created by https://www.gitignore.io/api/c++,macos +# Edit at https://www.gitignore.io/?templates=c++,macos + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# End of https://www.gitignore.io/api/c++,macos diff --git a/README.md b/README.md index 3a20aeb..1858fad 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ output is printed on transparency film and overlaid. The [dithercrypt program](dithercrypt/dithercrypt.py) supports four variants: -* "encrypt2" encrypts a single image into two output grids. Taken +* "encrypt2" encrypts single image into two output grids. Taken individually, the grids are random noise. If overlaid, the image is revealed. Black areas of the secret image will appear entirely black; white areas will be half black and half white; and gray areas will be more than half black and less than half white. -* "encrypt3" encrypts a three images into three output grids. Taken +* "encrypt3" encrypts three images into three output grids. Taken individually, the grids are random noise. If two grids are overlaid, one of the three input images will be revealed. Black areas of the secret image will appear entirely black; white areas @@ -37,10 +37,15 @@ gamma. To print the results, you'll need to use a program that will give pixelated output instead of trying to interpolate. +Example usage: +``` +python /path/to/dithercrypt.py encrypt2 /path/to/inputimage.jpg output1.jpg output2.jpg +``` + # Visual cryptography workshop This is a placeholder. It's very awkward to use right now. # License -MIT \ No newline at end of file +MIT diff --git a/dithercrypt/dithercrypt.py b/dithercrypt/dithercrypt.py index bb81775..6a073d1 100755 --- a/dithercrypt/dithercrypt.py +++ b/dithercrypt/dithercrypt.py @@ -20,7 +20,7 @@ def save_img(img, fn): def encrypt2(img): shape = img.shape - + out1 = np.zeros(shape, dtype=np.uint8) out2 = np.zeros(shape, dtype=np.uint8) @@ -41,7 +41,7 @@ def steg2(clear1, clear2, secret): shape = clear1.shape if shape != clear2.shape or shape != secret.shape: raise TypeError('all three images must have the same shape') - + out1 = np.zeros(shape, dtype=np.uint8) out2 = np.zeros(shape, dtype=np.uint8) @@ -192,7 +192,7 @@ def encrypt4(img_ab, img_ac, img_ad, img_bc, img_bd, img_cd): return (out_a, out_b, out_c, out_d) commands = [ - ('encrypt2', 2, 2, encrypt2), + ('encrypt2', 1, 2, encrypt2), ('steg2', 3, 2, steg2), ('encrypt3', 3, 3, encrypt3), ('encrypt4', 6, 4, encrypt4), diff --git a/masks/make_masks.py b/dithercrypt/masks/make_masks.py similarity index 100% rename from masks/make_masks.py rename to dithercrypt/masks/make_masks.py diff --git a/masks/mask_left.html b/dithercrypt/masks/mask_left.html similarity index 100% rename from masks/mask_left.html rename to dithercrypt/masks/mask_left.html diff --git a/masks/mask_right.html b/dithercrypt/masks/mask_right.html similarity index 100% rename from masks/mask_right.html rename to dithercrypt/masks/mask_right.html diff --git a/masks/rects_negative.svg b/dithercrypt/masks/rects_negative.svg similarity index 100% rename from masks/rects_negative.svg rename to dithercrypt/masks/rects_negative.svg diff --git a/masks/rects_positive.svg b/dithercrypt/masks/rects_positive.svg similarity index 100% rename from masks/rects_positive.svg rename to dithercrypt/masks/rects_positive.svg diff --git a/index.php b/index.php new file mode 100644 index 0000000..1377d9a --- /dev/null +++ b/index.php @@ -0,0 +1,3 @@ + diff --git a/website/css/index.css b/website/css/index.css new file mode 100644 index 0000000..4f6b235 --- /dev/null +++ b/website/css/index.css @@ -0,0 +1,43 @@ +body { + font-size: 11pt; + margin: 3em; + background: #fff; + color: #444; + max-width: 100%; + font-family: monospace; +} + +h1 { + text-transform: uppercase; + font-size: 1em; +} + +h2 { + font-size: 1em; + text-transform: uppercase; + margin-top: 1em; +} + +section a { + color: #444; + display: block; + margin: 0; +} + +a:hover { + color: #268bd2; +} + +.postdate { + color: #CCC; +} + +@media (max-width: 1080px) { + body { + margin: 3em; + font-size: 20pt; + } + a { + margin-top: 0.25em; + } +} diff --git a/website/css/style.css b/website/css/style.css new file mode 100644 index 0000000..bbfb669 --- /dev/null +++ b/website/css/style.css @@ -0,0 +1,103 @@ +body { + color: #000; + background: #FFF; + + max-width: 30em; + margin: 6em 3em 6em 6em; + + font-family: sans-serif; + font-style: normal; + font-size: 11pt; + line-height: 1.5; +} + +h1, h2, h3, h4 { + margin-bottom: 0; + padding-bottom: 0; + font-size: 1em; +} + +p { + margin-top: 0.5em; + margin-bottom: 0; + text-align: left; + hyphenate: auto; + hyphenate-before:2; + hyphenate-after:3; +} + +/* all paragraphs that are proceeded by another paragraph. tiny paragraphs don't + * count */ +p:not(.tiny) + p, figure + p { + margin-top: 0; + text-indent: 1.5em; +} + +p.tiny, #bottom { + margin-top: 1em; + 1argin-bottom: 1em; + text-indent: 0; + color: #CCC; +} + +img { + width: 100%; +} + +figcaption { + margin-top: 0.5em; +} + +figure { + margin: 1.5em 8em; + padding: 2em 0; + max-width: 600px; +} + +@media (max-width: 700px) { + figure { + margin: 1.5em 0; + } +} + +pre { + margin: 1em 2em; +} + +pre code { + background: none; + font-size: 1em; +} + +code { + background: rgba(0, 0, 0, 0.05); + padding: .2em; + font-size: .8em; +} + +a { + color: #268bd2; + text-decoration: none; +} + +a:hover { + color: #1a6192; +} + +#header, header { + float: left; + width: 100%; + line-height: 1.3; + padding-bottom: 4em; +} + +#header h1, header h1 { + padding: 50px 0 0 0; + margin: 0; +} + +#header h2, header h2 { + margin: 0; + color: #CCC; +} + diff --git a/website/index.php b/website/index.php new file mode 100644 index 0000000..510767c --- /dev/null +++ b/website/index.php @@ -0,0 +1,16 @@ + + + + +
+