He worked for the NSA as an intern for a while, and implemented Tor shortly after leaving. I don't know what he did for the NSA, but I imagine something to do with traffic analysis. He still has a lot of friends in the NSA as well. He actually is fairly open about this, although I heard about it from Steve quite some time before I saw him admit it publicly. Actually two of the lead Tor developers have ties to US intelligence agencies, Dingledine to the NSA and Syverson to Naval Intelligence. I think Mathewson is the only lead developer without a US intelligence background.