This is what I have so far, import struct
EncryptString="313B372C2E2C63362E2128" XorKey="41424344" key = struct.unpack("d", XorKey) num_ints = len(EncryptString)/11 data = struct.unpack("%dd"% num_ints,EncryptString) The above code generates an error the my string must be a string length of 16 When you say I need to determine the number of ints in my data i.e. EncryptString that value would be 11 right? I appreciate your help. Mike. On Sat, Oct 24, 2009 at 2:41 PM, ALAN GAULD <alan.ga...@btinternet.com>wrote: > > 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