----------------------------------------------------------------------------------
@MSGID:
<0351745e-2e54-42ea-b469-e35952986a27n@googlegroups.com> cd592f63
@REPLYADDR Rick Hohensee
<presidentbyamendment@gmail.com>
@REPLYTO 2:5075/128 Rick Hohensee
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
<0351745e-2e54-42ea-b469-e35952986a27n@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
#Bit-Banging in Bash (with od and rm)
# Adler32 checksum of a file with Bash, rm, and od.
# Rick rickfordictator.com Hohensee August 2023
# E is the checksum. Android .dex files use Adler32.
# not checked much, but it is clearly doing binary data.
decimalbytes ()
{
od -An -v -t d1 -w1 $1 >> decimal.out
}
Subadler () { # < decimal.out
A=1 B=0
while read
do
let A=$(($A+$REPLY))
let A=$(($A&0xffffffff))
let B=$B+$A
let B=$(($B&0xffffffff))
done
}
Adler32 () {
decimalbytes $1
Subadler < decimal.out
rm decimal.out
C=$((A%65521))
D=$((B%65521))
echo "C =" $C " D = " $D
E=$(((D<<16)|C))
echo $E
}
--- G2/1.0
* Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5075/128
@PATH: 5075/128 5020/1042 4441