Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: XOR'ing to calculate a hex checksum

by thospel (Hermit)
on Jan 28, 2008 at 23:28 UTC ( [id://664812]=note: print w/replies, xml ) Need Help??


in reply to XOR'ing to calculate a hex checksum

Unpack has the little known property to be able to calculate sums in several bit widths. In this case first convert the hexadecimal representation to a character string, sum over that in 8 bits and invert:
perl -wle 'print 0xff ^ unpack "%8C*", pack"H*", "00018108000202020202 +0202"' 103

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://664812]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found