changed hcl_inttostr()

touched up log output and formatted output functions
This commit is contained in:
2019-04-16 15:46:00 +00:00
parent dc3c393247
commit 9045220ef8
6 changed files with 170 additions and 152 deletions

View File

@ -1,11 +1,35 @@
a=`openssl rand -hex 20 | tr '[a-z]' '[A-Z]'`
b=`openssl rand -hex 19 | tr '[a-z]' '[A-Z]'`
count=0
while true
do
/bin/echo -n -e "$count\r"
count=$(($count + 1))
q1=$(echo -e "ibase=16\nprint ($a / $b)" | bc -q)
r1=$(echo -e "ibase=16\nprint ($a % $b)" | bc -q)
a=`openssl rand -hex 1 | tr '[a-z]' '[A-Z]'`
a=$(echo -e "(printf \"%O\" #x$a)" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
[ "$a" = "0" ] && a=1
a=`openssl rand -hex $a | tr '[a-z]' '[A-Z]'`
b=`openssl rand -hex 1 | tr '[a-z]' '[A-Z]'`
b=$(echo -e "(printf \"%O\" #x$b)" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
[ "$b" = "0" ] && b=1
b=`openssl rand -hex $b | tr '[a-z]' '[A-Z]'`
a=$(echo -e "(printf \"%O\" #x$a)" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
b=$(echo -e "(printf \"%O\" #x$b)" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
[ "$b" = "0" ] && b=1
q2=$(echo -e "(printf \"%O\" (/ #x$a #x$b))" | ~/xxx/bin/hcl /dev/stdin 2> /dev/null)
r2=$(echo -e "(printf \"%O\" (rem #x$a #x$b))" | ~/xxx/bin/hcl /dev/stdin 2>/dev/null)
echo "$q2"
echo "$r2"
q=$(echo -e "(printf \"%O\" (/ $a $b))" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
r=$(echo -e "(printf \"%O\" (rem $a $b))" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
a1=$(echo -e "(printf \"%O\" (+ (* $q $b) $r))" | ~/xxx/bin/hcl --log /dev/null /dev/stdin)
if [ "$a" != "$a1" ]
then
echo "a=>$a"
echo "b=>$b"
echo "q=>$q"
echo "r=>$r"
echo "a1=>$a1"
break
fi
done