2009/10/15 Kent Johnson :
> On Wed, Oct 14, 2009 at 10:48 PM, Wayne wrote:
>
>> Using zip is redundant for me, this is what my function looks like now:
>> def crypt(msg, mask):
>> m = itertools.cycle(mask)
>> word = ''
>> for l in msg:
>> word += chr(ord(l) ^ ord(m.next()))
>>
On Wed, Oct 14, 2009 at 10:48 PM, Wayne wrote:
> Using zip is redundant for me, this is what my function looks like now:
> def crypt(msg, mask):
> m = itertools.cycle(mask)
> word = ''
> for l in msg:
> word += chr(ord(l) ^ ord(m.next()))
> return word
With zip() and a ge
On Wed, Oct 14, 2009 at 6:31 PM, Rich Lovely wrote:
>
> Specifically, cycle and izip. itertools.cycle is the trick here, izip
> is a more efficient (in this case) version of zip.
Ahah! Cycle is exactly what I wanted - I thought there was something like
this but I forgot where I found it.
Using
"Wayne" wrote
I've searched "Python masking" and various other terms in Google and the
python docs and came up with nothing useful.
Try the Using the OS topic in my tutorial. There is a sidebar in
there about using the bitwise operators to do masking about half way down.
HTH,
--
Alan Gau
2009/10/14 Wayne :
> I've searched "Python masking" and various other terms in Google and the
> python docs and came up with nothing useful.
> This is just a bit of a hobby project that was inspired by some assembly
> homework that one of my friends is now doing and I did last semester. The
> assig
I've searched "Python masking" and various other terms in Google and the
python docs and came up with nothing useful.
This is just a bit of a hobby project that was inspired by some assembly
homework that one of my friends is now doing and I did last semester. The
assignment was to create a program