Early in his career as the United States government’s go-to man on all things cryptologic, William Friedman was asked if insanity was a prerequisite of the codebreaker. Friedman didn’t hesitate in his response. It was “not necessary,” he said, “but it helps.” 
A flippant response to reinforce the cryptanalyst’s mystique? A glib remark to get a laugh? Perhaps. But the task of worrying a garble of letters for days or weeks at a time, holding to a faith that the effort will yield results, took a certain kind of, if not insanity, then extreme doggedness not found in ordinary men. But which is the cause and which the effect? In Friedman’s case, at least, the witticism hid a painful truth. America’s greatest cryptologist was predisposed to anxiety/self-doubt/depression which his profession’s relentless demands only exacerbated.
It was not just the stress of work on whose success the security and survival of the nation relied. It was the doubt he harbored–doubt that only grew stronger with the years–about his profession’s moral legitimacy, at least in practice. Coming out of the Second World War, the intelligence organization Friedman had helped build only expanded its operations in peacetime. The Cold War brought new levels of, what Friedman saw as, paranoia and security obsessiveness. Genetics, the field he might have entered thirty-five years before, was just then coming into bloom. Its promise posed a stark contrast with the increasingly tainted world of intelligence-gathering (and -withholding). To Henry Stimson’s biographer on the question of gentlemen reading each others’ mail, he wrote, “You may be interested to know that my own feelings on the ethical point at issue are quite ambivalent–and have been for a long time. I have often wondered whether a good portion of my psychic difficulties over the years are not attributable, in part at least, to that ambivalence.”  To another historian he wrote about “the frustration generated by my having chosen as a profession one so enmeshed with measures requiring great secrecy–some quite necessary, some quite absurd or futile….” 
It didn’t help that he had become the object of the NSA’s paranoia. His papers, many of them going back as far as the First World War, were reclassified as “confidential” by the newly-organized National Security Agency. This was a slap in the face to a man who had given so much in his country’s service. Having foregone more lucrative opportunities in his prime working years, he had hoped to garner some income in retirement from the sale of his works. Not if the NSA had anything to say about it, which it did.
More slaps: Forty-eight volumes from his personal library, fastidiously organized in his Capitol Hill home, were confiscated as security risks by two NSA agents–a raid on the United States’ most accomplished cryptologist. “The NSA considers me their greatest security risk,” said an exasperated, and perhaps self-pitying, Friedman. 
Writing to longtime friend Boris Hagelin, Friedman was less caustic, more self-aware. Besides a genius for cryptography, both men shared a birthplace in the former Russian empire; both were, using Hagelin’s locution, “neurotics.”  In a phraseology more in line with our own time, the men gave each other therapy through their correspondence.
That’s the way it sounds to me in a letter Friedman biographer Ronald Clark quotes at length: “My nervousness, depression, at times despondency–frightening to be alone a/c suicidal thoughts–realization of how wrong that would be in all respects. Flight, fight, or neurosis. For fifty years have struggled with this off and on.” Friedman is surprisingly honest about his concern for his “reputation” and his “feeling of being a ‘has-been.'” His reference to a “‘floating anxiety’ which attaches itself to anything and everything” evinces the all-encompassing nature of his mental illness. [258-259]
Another side of his “neurosis” caught my attention in an amusing and withal not insignificant anecdote. After submitting a manuscript on the inscrutable Voynich codex, Friedman had post-eleventh-hour second-thoughts, as explained in this letter to his editor:
I went to play a round of golf, alone as usual, during the week. This is often bad for me because I have not only time to play but also to think. I get ideas for improving (and often ruining instead) this and that, which is bad for one who should be content to leave well enough alone. The idea I have (you’ve no doubt divined that I’m about to spring it on you) is this: I’d like to delete the last two sentences of footnote 28 and substitute the following…: [216-217]
Golf is one game, played alone or not, that can distract the average man from life’s cares and focus him instead on balls and holes and keeping his head down. Not one as cerebral as William Friedman. No, this is “bad” for him, and “bad” again. He can’t keep “ideas for improving (and often ruining instead)” from storming his mental fortress. This is impressive self-awareness, revealing an understanding that over-thinking can be as hazardous as thinking too little. Evident, too, is a recognition that such an awareness is not sufficient safeguard against the demons that haunt you.
A note of recognition registered as I read these words. I have “ruined” more than my share of lesson plans by over-thinking them, though I’m not sure this is literally true. I’m not sure Friedman believed it about his case, either. What is ruined in this particular neurosis is one’s mental equanimity, something indispensable in a teacher of children–and pretty important in a cryptographer helping to save the free world, too. Like Friedman when he made the comments above, I am fully aware of both the hazards and, yes, benefits, of my obsessiveness. As a result, its grip on me is less debilitating. Like him, this self-awareness does not preclude persistent, periodic self-doubt (and, in my case, self-loathing). Unlike the great cryptologist, I have never been hospitalized for my psychiatric imbalances. I doubt I ever will be.
Source: Clark, Ronald. The Man Who Broke Purple: The Life of Colonel William F. Friedman, Who Deciphered the Japanese Code in World War II. Boston: Little, Brown and Company, 1977.