How can I replicate Perl's unpack functionality in C#?

c#, perl, unpack

Solution

There seems to be a library in Mono called DataConvert that was written to provide facilities similar to Perl's pack/unpack. Does this do what you need?

Problem

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)

Original source