R
Ralph Smith
If I run this code to compute a "checksum" of a file I get a different answer on a windows machine
and a FreeBSD machine. Does anyone know why? Or a better way to get a quick checksum of a file?
fname = ARGV[0]
size = File.size(fname);
checksum = 0;
f = File.new(fname)
f.each_byte {|x| checksum += x }
printf("%s: %d ( %x hex )\n", fname, checksum, checksum)
Thanks,
Ralph
and a FreeBSD machine. Does anyone know why? Or a better way to get a quick checksum of a file?
fname = ARGV[0]
size = File.size(fname);
checksum = 0;
f = File.new(fname)
f.each_byte {|x| checksum += x }
printf("%s: %d ( %x hex )\n", fname, checksum, checksum)
Thanks,
Ralph