M
Matthias =?ISO-8859-1?Q?G=FCntert?=
Hello list-members
i am in the process of writing a python script to backup my data. Now I
would like to implement md5/sha1 hashes.
# do md5 fingerprinting
if config.get("global", "crc") == "md5":
m = md5.new()
# open the file
f = open(fname, "rb")
while 1:
block = f.read(1024*1024)
if not block:
break
# generate the hash
m.update(block)
f.close()
# write the results properly formated to a file
fd = file(fname + ".md5", "w")
fd.write(m.hexdigest())
fd.write(" " + fname + "\n")
fd.close()
mguentert@uranos > md5sum -c backup.tar.bz2.md5
/fileservice/temp/backup.tar.bz2: FAILED
md5sum: WARNING: 1 of 1 computed checksum did NOT match
mguentert@uranos > cat backup.tar.bz2.md5
d41d8cd98f00b204e9800998ecf8427e /fileservice/temp/backup.tar.bz2
so the format should be okay, but whats wrong with my piece of code?!
Greetings
--
Mit freundlichen Grüßen
Matthias Güntert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)
iD8DBQBEJquauQEWmvzea70RArn0AKC+ktZwzHUcXY+qqgN+Yj50p5ilzACdE7X5
+apebd9xy1GCHeRGhHbw3Hc=
=ZDGF
-----END PGP SIGNATURE-----
i am in the process of writing a python script to backup my data. Now I
would like to implement md5/sha1 hashes.
# do md5 fingerprinting
if config.get("global", "crc") == "md5":
m = md5.new()
# open the file
f = open(fname, "rb")
while 1:
block = f.read(1024*1024)
if not block:
break
# generate the hash
m.update(block)
f.close()
# write the results properly formated to a file
fd = file(fname + ".md5", "w")
fd.write(m.hexdigest())
fd.write(" " + fname + "\n")
fd.close()
mguentert@uranos > md5sum -c backup.tar.bz2.md5
/fileservice/temp/backup.tar.bz2: FAILED
md5sum: WARNING: 1 of 1 computed checksum did NOT match
mguentert@uranos > cat backup.tar.bz2.md5
d41d8cd98f00b204e9800998ecf8427e /fileservice/temp/backup.tar.bz2
so the format should be okay, but whats wrong with my piece of code?!
Greetings
--
Mit freundlichen Grüßen
Matthias Güntert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)
iD8DBQBEJquauQEWmvzea70RArn0AKC+ktZwzHUcXY+qqgN+Yj50p5ilzACdE7X5
+apebd9xy1GCHeRGhHbw3Hc=
=ZDGF
-----END PGP SIGNATURE-----