summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-09-27 07:04:21 +0200
committerjonsykkel <jonrevold@gmail.com>2021-09-27 07:05:39 +0200
commitc295e58a90828b45bfc0bae3e26c8026400b91c6 (patch)
treea1b09c3d0a8eff3d088944a967ddd2e91dc38cf2
parenta1412938d3f79679cb2065cae48c0b5f8e5b7eb1 (diff)
downloadokeffa-c295e58a90828b45bfc0bae3e26c8026400b91c6.tar.gz
oke misunersod ch8 hw
-rw-r--r--makefile4
-rw-r--r--prog/ch81
-rwxr-xr-xprog/ch8.sh15
3 files changed, 3 insertions, 17 deletions
diff --git a/makefile b/makefile
index 8db4579..0e187f5 100644
--- a/makefile
+++ b/makefile
@@ -66,8 +66,8 @@ out := $(bin_dir)/$(out)
ifneq ($(run),)
run_cmd := @echo "run $(out)" 1>&2
#run_cmd += && ./$(out) 256 16
- run_cmd += && time $(out) 2048 16 < prog/ch7
- #run_cmd += && prog/ch8.sh $(out)
+ #run_cmd += && time $(out) 2048 16 < prog/ch7
+ run_cmd += && ./$(out) 256 16 < prog/ch8 | python
endif
ifneq ($(debug),)
diff --git a/prog/ch8 b/prog/ch8
new file mode 100644
index 0000000..e8809d7
--- /dev/null
+++ b/prog/ch8
@@ -0,0 +1 @@
+??``[print(0x]#[*0x]#*[==0x]##[)]
diff --git a/prog/ch8.sh b/prog/ch8.sh
deleted file mode 100755
index e16764e..0000000
--- a/prog/ch8.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-ffa=$1
-bytes=256
-
-a=$(LC_ALL=C tr -dc "0-9A-F" </dev/random | dd bs=$bytes count=1 2>/dev/null)
-b=$(LC_ALL=C tr -dc "0-9A-F" </dev/random | dd bs=$bytes count=1 2>/dev/null)
-eq_bc="$a*$b"
-eq_ffa=".$a.$b*_#Q"
-ans_bc=$(bc -e "ibase=G;obase=G;$eq_bc" | tr -d '\\\n')
-ans_ffa=$(echo -n "$eq_ffa" | $ffa $(($bytes*2*8)) 16 | sed 's/^0*//')
-
-echo "bc $ans_bc"
-echo "ffa $ans_ffa"
-[ "$ans_bc" = "$ans_ffa" ] && echo "true" || echo "false"