Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replicating Perl Unpack function in C#

Status
Not open for further replies.

djjohnnyg

Programmer
Oct 6, 2008
1
EU
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:

while (<PACKAGE>) {
$checksum += unpack("%32C*", $_);
}
$checksum %= 32767;
close(PACKAGE);
}

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)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top