From 4e9f76f4828f4b2162608080f060342c22fce04a Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Thu, 23 Mar 2023 22:38:13 -0700 Subject: [PATCH] fix Makefile and README.md for 2012/grothe --- 2012/grothe/Makefile | 19 +++++----- 2012/grothe/README.md | 86 ++++++++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/2012/grothe/Makefile b/2012/grothe/Makefile index a3dad05d8..810d06863 100644 --- a/2012/grothe/Makefile +++ b/2012/grothe/Makefile @@ -62,8 +62,8 @@ X11_INCDIR= /opt/X11/include # Common C compiler warnings to silence # -CSILENCE= -#CSILENCE= -Wno-implicit-int +#CSILENCE= +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-unused-value # Common C compiler warning flags # @@ -101,8 +101,8 @@ CINCLUDE= #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h -#CINCLUDE= -I ${X11_INCDIR} -#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 +#CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 +#CINCLUDE= `${SDL2_CONFIG} --cflags` # Optimization # @@ -126,7 +126,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL2 +#LIBS= `${SDL2_CONFIG} --libs` # C compiler to use # @@ -138,9 +138,9 @@ CC= cc # ifeq ($(CC),clang) # -CSILENCE+= -Wno-comma -Wno-missing-noreturn -Wno-missing-prototypes \ - -Wno-missing-variable-declarations -Wno-poison-system-directories \ - -Wno-shadow -Wno-unreachable-code +CSILENCE+= -Wno-comma -Wno-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-shadow -Wno-missing-noreturn \ + -Wno-unreachable-code # CWARN+= -Weverything # @@ -166,7 +166,7 @@ PROG= ${ENTRY} # OBJ= ${PROG}.o DATA= cookie_piece1.dat cookie_piece2.dat cookie_piece3.dat \ - cookie_piece4.dat cookie_recipe.txt + cookie_piece4.dat cookie_recipe.txt TARGET= ${PROG} # ALT_OBJ= @@ -326,4 +326,3 @@ pluto: charon @echo "dwarf is a type of planet" @echo "therefore, $@ is a planet" @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" - diff --git a/2012/grothe/README.md b/2012/grothe/README.md index 8dc0d3a2d..c36edce24 100644 --- a/2012/grothe/README.md +++ b/2012/grothe/README.md @@ -1,39 +1,46 @@ # Most conspiratorial -Aaron Grothe -2205 South 51st Street -Omaha, NE 68106 -US - + Aaron Grothe + 2205 South 51st Street + Omaha, NE 68106 + US + -David Madore - + David Madore + -## To build: +# To build: - make all +```sh +make +``` ### To run: - # To create a shared secret shared among M people with N+1 needed to reconstruct - ./grothe -secret 1-/dev/urandom 2-/dev/urandom ... N-/dev/urandom \ - 1+shared1 2+shared2 ... M+sharedM +To create a shared secret shared among M people with N+1 needed to reconstruct: - # To reconstruct the original (an arbitrary combination of N+1 or - # more shared files with their proper numbers) - ./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed +```sh +./grothe -secret 1-/dev/urandom 2-/dev/urandom ... N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM +``` + +To reconstruct the original (an arbitrary combination of N+1 or +more shared files with their proper numbers): + +```sh +./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed +``` ### Try: - ./grothe -grothe.c 1+grothe.c.1 2+grothe.c.2 +```sh +./grothe -grothe.c 1+grothe.c.1 2+grothe.c.2 - ./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \ - 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat +./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat - ./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat - +cookie_recipe_restore.txt +./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat 4+cookie_recipe_restore.txt +``` -### Selected Judges Remarks: +## Judges' comments: Also known as Best abuse of the judging process. @@ -63,7 +70,7 @@ into 3 parts and require two of them be available to extract the original recipe Actually surprisingly useful for an IOCCC entry :-) -**Usage** +### Usage To share a secret @@ -74,26 +81,30 @@ number of pieces - 2 + file to be shared total number of pieces created by program 4 pieces needed to reassemble recipe 3 or greater -**example usage** +### Example usage -\# to share secret into 4 pieces of which at least 3 will be needed to get back the recipe +To share secret into 4 pieces of which at least 3 will be needed to get back the recipe: - ./grothe \ - -cookie_recipe.txt - 1-/dev/urandom 2-/dev/urandom - 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat +```sh +./grothe \ + -cookie_recipe.txt + 1-/dev/urandom 2-/dev/urandom + 1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat +``` -\# put recipe back together using 1, 2 and 4th piece +To put recipe back together using 1, 2 and 4th piece: - ./grothe \ - 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat - +cookie_recipe_restore.txt +```sh +./grothe \ + 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat + +cookie_recipe_restore.txt +``` -**Limitations** +### Limitations * program is limited to 256 input and output files and will slow down dramatically when you get past 20-50 inputs and outputs -**Obfuscations** +### Obfuscations * nothing is done consistently throughout the program E.g i+=1, i=i+1, i++ and ++i are all used in the program. The mark of true code buggery. - "A foolish consistency is the hobgoblin of little minds" - Ralph Waldo Emerson * uses the most powerful obfuscation of all "Math". "Any sufficiently advanced cryptography is indistinguasble from magic" - Apologies to Arthur C. Clarke @@ -105,17 +116,16 @@ pieces needed to reassemble recipe 3 or greater * use of #defines from stdio.h, stdlib.h for values \_STDIO\_H and EXIT\_SUCCESS used to represent 1 and 0 respectively in the program * arrays only need to be 256x256 most are set to greater values than they need to be so trying to figure it out can be a bit tough -**References** +### References * Shamir's Secret Sharing - http://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing * David Madore's implementation of Shamir's Secret Sharing - http://www.madore.org/~david/programs/programs-1.36.html * Steve's Recipe Database - source for the $25k Cookie Recipe - http://recipes.stevex.net/ --------------------------------------------------------------------------------- -