Hopefully this is an easy one. I have a program that transfers files, and checks SHA values to ensure success. However I am now trying to transfer binary files, like tar/zip files, and the sha values are not matching up when i go from windows to unix, and unix to windows. This occurs regardless of if I use standard ftp, or my code to transfer the files.
Here is the code I'm using
my $file = shift;
my $data = shift;
my $val = 0;
my $sha1 = Digest::SHA->new(256);
#supposed to be portable and os independant? not working.
$val = $sha1->hexdigest;
print "An error occurred calculating the SHA-Value. Cannot ver
+ify integrity of file\n$@\n";
Any help you can offer is most appreciated!
RESOLVED: I'm really not sure what did it, but eventually using the $sha1->addfile($data, "p"); made everything work...A little confused as to why it wasn't when I first tried, must have missed something...but anyways, everything is working now, thank you all for the help