title: How Can I: Generate 40/64 Bit WEP Key In Python?
body: <p>So, I've been beating my head against the wall of this issue for several months now, partly because it's a side interest and partly because I suck at programming. I've searched and researched all across the web, but have not had any luck (except one small bit of success; see below), so I thought I might try asking the experts.</p>
  
  <p>What I am trying to do is, as the title suggests, generate a 40/64 bit WEP key from a passphrase, according to the "de facto" standard. (A site such as <a href="http://www.powerdog.com/wepkey.cgi" rel="nofollow noreferrer">http://www.powerdog.com/wepkey.cgi</a> produces the expected outputs.) I have already written portions of the script that take inputs and write them to a file; one of the inputs would be the passphrase, sanitized to lower case.</p>
  
  <p>For the longest time I had no idea what the defacto standard was, much less how to even go about implementing it. I finally stumbled across a paper (<a href="http://www.lava.net/~newsham/wlan/WEP_password_cracker.pdf" rel="nofollow noreferrer">http://www.lava.net/~newsham/wlan/WEP_password_cracker.pdf</a>) that sheds as much light as I've had yet on the issue (page 18 has the relevant bits). Apparently, the passphrase is "mapped to a 32-bit value with XOR," the result of which is then used as the seed for a "linear congruential PRNG (which one of the several PRNGs Python has would fit this description, I don't know), and then from that result several bits of the result are taken. I have no idea how to go about implementing this, since the description is rather vague.</p>
  
  <p>What I need is help in writing the generator in Python, and also in understanding how exactly the key is generated. In other words, I need code to turn "jackson" into "09F38AF593". (And please don't tell me jackson = 09F38AF593; print (jackson))</p>
  
  <p>I'm not much of a programmer, so explanations are appreciated as well.</p>
  
  <p>(Yes, I know that WEP isn't secure.)</p>