My perl is a bit rusty, but it looks like unpack just pulls out a list of variables from a binary string.
%32C says to produce a 32bit checksum of the object instead of the object itself (Presumably the C just tells it to produce a "hex"-string by using unsigned characters?)
I guess you would have to find out what the checksum method they use is and implement that.
Replicating Perl's unpack functionality in C#
Collapse
X
-
Replicating Perl's unpack functionality in C#
Hi,
I am trying to recreate a perl script in C# but have a problem creating a checksum value that a target system needs.
In Perl this checksum is calculated using the unpack function:
[code=perl]
while () {
$checksum += unpack("%32C*", $_);
}
$checksum %= 32767;
close(PACKAGE);
}[/code]
where PACKAGE is the .tar file input stream
I need to replicate this in C# but can't find a means of replicating that unpack function.
All help appreciated!
(I know there are much better checksum calculations available but can't change target system so can't change calculation)Tags: None
Leave a comment: