Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2015-07-06 05:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls