Ask a Question related to PERL Miscellaneous, Design and Development.
-
Robert Lynch #1
md5sum of umounted cd-rom (warning: 'orrible perl code ahead)
How do you compute the md5sum of a cdrom you have burned? Googling
seems to reveal this to be a "difficult" problem. The complaint is
something like: "I burned the CD, but now the md5sum is different than
the one posted on the download site!"
It appears to me that the problem is related to file block size,
padding, etc.
One can find the size of a cd-rom in linux using the command "isosize"
(from util-linux package). Then you can (hack, hack, chop, mangle...)
compute it as follows:
===
# $Id: md5.pl,v 1.2 2003/07/17 17:15:11 user Exp user $
# reads md5sum from unmounted CD-ROM in drive
# run as perl -w md5.pl
use Digest::MD5;
# CD-ROM device file on my system.
$file = "/dev/scd0";
# Install/adjust path to isosize depending on distro
my $size = `/usr/bin/isosize $file`;
#print "Size of $file: $size\n";
# Read $size bytes into a variable
# Perl Cookbook, p. 276
# TODO - read chunks, compute md5sum
# so as not to bog down system.
open FH, $file or die "Couldn't open $file: $!\n";
my $read = sysread(FH, $data, $size, 0);
close FH;
# Lifted from Digest::MD5 man page
my $md5 = Digest::MD5->new;
$md5->add($data);
$digest = $md5->hexdigest;
print "$digest - $file\n";
===
I'm sure you whizzes will take one whiff of this (while holding your
noses) and then immediately come up with something neater and perlish.
But in the meantime: "There's More Than One Way To Do It."
Bob L.
Robert Lynch Guest
-
asp code jumps ahead of dts package results
ok here is my predicament - i have an asp page that calls a dts package to decrypt a file, then the asp processes the decrypted version of the... -
Custom tool warning: DiscoCodeGenerator unable to initialize code generator. No code generated.
I created a brand new WebService (HelloWorld) and when I attempt to add this WebService to a WindowsForm project I get the following error message in... -
Perl code
Hi there, Where can i find a perl code that translate numbers to words ?, like 100.00 for "one hundred ..." I need it to glue it with some other... -
using perl in a c code
I am writing a c program In which I have some heavy text parsing to do. Unfortunately I am not very conversant with C or Regex in C I have read... -
Using md5sum
I don't remember the source of the following instructions that I have in my notes. "To use these things* you use the linux program md5sum. type...



Reply With Quote

