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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||