python - How to XOR literal with a string -


i'm trying implement blowfish algorithm in python. way understand it, have use key "abcd" , xor hexadecimal array (cycling key if necessary)

p = (       0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,       0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,       0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b,     ) 

the data types here have me confused. saw somewhere 'abcd' = 0x61626364. in case, xoring first element of p 0x61626364 ^ 0x243f6a88.

so, how convert string 'abcd' format 0x?????. or perhaps there's better way? light on appreciated!

to convert string array of bytes:

b = bytes('abcd', 'ascii') 

to convert array of bytes int:

i = int.from_bytes(b, byteorder='big', signed=false) 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -