BackupPC-users

[BackupPC-users] Digest::MD5 vs md5sum

2015-09-15 15:34:02
Subject: [BackupPC-users] Digest::MD5 vs md5sum
From: gregrwm <backuppc-users AT whitleymott DOT net>
To: backuppc-users AT lists.sourceforge DOT net
Date: Tue, 15 Sep 2015 14:08:20 -0500
the following commands demonstrate that either Digest::MD5 and gnu md5sum are not compatible, or that i haven't got the backuppc md5 formula quite right.  can anyone set me straight?  the commands below merely use the filesize, and the whole file since it's <256K, feed them both to md5sum, and show the result adjacent the filename.  the below shows /etc/papersize and it's poolfile:

$ alias zcat=/usr/share/?ackup??/bin/BackupPC_zcat
$ alias li=ls' -aFqldi --color --time-style=+%F" %a "%T'
$ 1b()(printf \\x$(printf %x $1))
$ 2b()(1b $(($1      /  256));1b $(($1%  256)))
$ 4b()(2b $(($1%2**32/65536));2b $(($1%65536))) #write rightmost 4 bytes
$ 4b 513         |xxd                           #4b sanity tests
0000000: 0000 0201                                ....
$ 4b 65539       |xxd
0000000: 0001 0003                                ....
$ 4b $((2**32-7))|xxd
0000000: ffff fff9                                ....
$ 4b $((2**32+9))|xxd
0000000: 0000 0009                                ....
$ md5sum --version|head -1
md5sum (GNU coreutils) 8.13
$ um()(s=$( cat $1|wc -c) m=$((4b $s; cat $1|sf)|md5sum);echo $(li $1) $m s=$s) #li & md5 of uncompressed argfile
$ zm()(s=$(zcat $1|wc -c) m=$((4b $s;zcat $1|sf)|md5sum);echo $(li $1) $m s=$s) #li & md5 of  compressed argfile
$ sf()if [ $s -le $(( 256*1024)) ];then cat                                     #select filedata for md5
>   elif [ $s -le $((1024*1024)) ];then
>      dd bs=128K count=1
>      tail -c128K
>   else
>      dd bs=128K count=1
>      dd bs=128K skip=6 count=1
>   fi
$ cat /etc/papersize
a4
$ xxd /etc/papersize
0000000: 6134 0a                                  a4.
$ um /etc/papersize
349898 -rw-r--r-- 1 root root 3 2014-01-01 Wed 17:39:09 /etc/papersize 12cf0b6059ccc2701eb9e55277f161c2 - s=3
$ zm /var/lib/backuppc/pc/127.0.0.1/0/f%2f/fetc/fpapersize
19720838 -rw-r----- 40 backuppc backuppc 11 2015-04-23 Thu 02:30:49 /var/lib/backuppc/pc/127.0.0.1/0/f%2f/fetc/fpapersize 12cf0b6059ccc2701eb9e55277f161c2 - s=3
$ zm /var/lib/backuppc/cpool/7/a/5/*991
19720838 -rw-r----- 40 backuppc backuppc 11 2015-04-23 Thu 02:30:49 /var/lib/backuppc/cpool/7/a/5/7a59e82651106239413a38eb30735991 12cf0b6059ccc2701eb9e55277f161c2 - s=3
------------------------------------------------------------------------------
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
<Prev in Thread] Current Thread [Next in Thread>