> Take the 4 byte XOR key.  If I convert them to int with Base 16
>  it takes the 4 and converts it to 0x34 when I in turn I actually need 0x41.  

OK, thats because int is for converting strings. You need to use struct.unpack
to convert the 4 bytes into an int.

You also need to figure out how many ints you have in your data and 
construct a format string with that many ints to struct unpack the data.

Them apply the xor to each int using the key

something like

key = struct.unpack("d", keydata)
num_ints = len(raw_data)/len(int)
data = struct.unpack("%dd" % num_ints, raw_data)

result = [n^key for n in data]

(untested pseudo code!)

HTH,

Alan G.    
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to