Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^3: strings to number and XOR

by almut (Canon)
on Oct 07, 2009 at 18:23 UTC ( #799773=note: print w/ replies, xml ) Need Help??

in reply to Re^2: strings to number and XOR
in thread strings to number and XOR

I've tried directly with $key++

The problem with Perl's string-increment is that the string has to match the pattern /^[a-zA-Z]*[0-9]*\z/ for it to work...(see perlop).  So you'd have to increment the corresponding numeric value, e.g.

$key = "\x4f\xcb"; for (1..10) { $key = pack('n',unpack('n',$key)+1); # ++ print unpack("H*", $key), "\n"; } __END__ 4fcc 4fcd 4fce 4fcf 4fd0 4fd1 4fd2 4fd3 4fd4 4fd5

Comment on Re^3: strings to number and XOR
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (1)
As of 2015-10-10 10:06 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (255 votes), past polls