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
|
---|
In Section
Seekers of Perl Wisdom