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

Re3: A real challenge

by bikeNomad (Priest)
on Jul 16, 2001 at 20:39 UTC ( #97079=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: A real challenge
in thread A real challenge

You're making $key too long by a factor of 39. You want something more like this (where @encoded is the given byte array):

my $encodedString = pack('c*', @encoded); my $key = 'Copyright 2000 ActiveState Tool Corp.'; $key = $key x ( length($encodedString) / length($key) + 1); $key = substr($key, 0, length($encodedString)); print $key ^ $encodedString;


Comment on Re3: A real challenge
Download Code
Replies are listed 'Best First'.
Re: Re3: A real challenge
by larryk (Friar) on Jul 16, 2001 at 20:57 UTC
    I know - it's just so that the key can be any length without having to do the length X/length y + 1 thing all on one line :) I have to substr it anyway so what's a few bytes between system calls! I wouldn't have been so frivolous if I was getting the key from STDIN though!

    "Argument is futile - you will be ignorralated!"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2015-07-31 01:18 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 (274 votes), past polls