James Martin/CNET

In a beige, nondescript building on the edge of San Francisco's industrial district, rare-books expert Cassandra Hatton opens a black, book-shaped case with gold lettering etched on its cover and spine. Inside is an ordinary-looking journal containing the mathematical musings of a man with extraordinary talents: mathematician and war hero Alan Turing.

Turing's influence permeates the computer industry. He was the first to devise the notion of step-by-step instructions, or algorithms, for performing calculations. His so-called Turing machine concept became the basis of the digital computer. Now the public is getting a glimpse of his mathematical brilliance at work.

"[Turing's work] has an impact on every single person, at least in the Western world," said Hatton, a senior specialist in Fine Books & Manuscripts and Space History at auction house Bonhams. "The way the world functions now would not exist without him."

Hatton has handled the first editions of Galileo's "Dialogo" and Newton's "Principia" as well as manuscripts written by Albert Einstein and Richard Feynman. Yet she counts Turing's journal, surfacing publicly for the first time since his death 61 years ago, as one of the top scientific documents she's held. That's because it's the most extensive example of Turing's handwritten notations -- covering 56 pages -- ever seen. Bonhams, which will put the document up for auction in April, expects it to fetch "at least seven figures," a portion of which will go to charity.

"He was not known for handwriting things," said Hatton. "It was either in his head or he would type it out. In all likelihood, this is the only manuscript like this."

Code breaking by day, math by night

Hatton removed the multicolored notebook from its case, placed it on a table and then opened it to show the pages filled with line after line of math theory and equations, in Turing's precise handwriting.

She's concluded that he wrote his notes sometime between 1940 and 1942, while Turing was playing a pivotal role at Bletchley Park cracking intercepted coded messages from the Nazis.

Essentially, he was cracking codes during the day and working on mathematics at night.

Hatton has spent a year researching the different mathematical theories Turing was working on. She compared Turing's math work to figuring out a mistake in Sudoku, a Japanese puzzle game where the player inserts numbers to complete a math equation.

"You can't guess. If you make a mistake, you're 20 moves along and you don't know where you went wrong," she said. "He's looking at how his predecessors are looking at mathematical notations...he's trying to see where they went wrong so he can make it right."

The manuscript is all business, but there are some moments when his personality comes through. "Hateful!" reads a tiny note over an equation.

Turing wrote about a mathematical theory on one side of the notebook; then flipped the book over to write from the other end about mathematical notations. In the middle of the notebook is a dream journal written by Robin Gandy, Turing's colleague and heir to all of Turing's papers. Unlike Turing's other papers, which Gandy archived, the journal was locked away and remained undiscovered until Gandy's death in 1995.

Turing's notes give a glimpse at the roots of computer science, according to Vijay Pande, a Stanford University professor of computer science who examined a few pages.

"It's clear that fundamental logic is at the heart of computer science and everything we do -- and in that sense it's clear the whole field owes Turing so very much," he wrote in an email. "But in a sense, it also shows how far we've come."

It's hard to overstate Turing's impact on our world. His concept of the Turing machine led to the development of digital computers. "I propose to consider the question, 'Can machines think?'" he wrote in a paper in 1950. That proposal led to the Turing Test, in which a person tries to distinguish whether she's interacting with another human or with a computer. The notion has become the basis of artificial intelligence, the technology underlying digital assistants like Siri, Cortana or Google Now.

"I think the fact that we all carry Turing machines around in our pockets and still argue about the Turing test 70-plus years later says it all," Marc Andreessen, partner of venture capital firm Andreessen Horowitz, said about Turing's influence.

From rotors to hashtags

The Oscar-nominated "The Imitation Game," based primarily on Turing's work at Bletchley Park, is just finishing its run in theaters.

In it, actor Benedict Cumberbatch portrays Turing standing in front of a giant machine made of wires and rotors clicking into position. It's an exaggerated depiction of Turing's Bombe Machine, used to decode the Nazi's Enigma machine messages during World War II. Historians estimate that the work of Turing and his team shortened the war by two to four years.

At the movie's end, a caption tells us Turing's invention would later evolve into modern-day computers.

"That was really cool, but how does that become what we use now?," my 24-year-old cousin asked after watching the movie last week. "Like, how do I hashtag with that?"

In truth, Turing first devised his concept for what would become a digital computer in the 1930s. Long before the Bombe, which was designed to do only one thing: search for possible settings needed to decrypt messages. Turing had conceived the idea of a machine that could store both data and instructions in memory.

"It's no exaggeration to say he's a founding father of every computer and Internet company today," Google Engineering Director Andrew Eland wrote in 2012 in Google's "tribute to Alan Turing, the father of modern computing."

"While his wartime code breaking saved thousands of lives, his own life was destroyed when he was convicted for homosexuality. But the tragedy of his story should not overshadow his legacy," Eland wrote.

In its own way, that tragedy has just as big an impact on our modern society as Turing's scientific achievements, said Hatton. Though a brilliant mathematician and war hero, he was considered a criminal at a time when acts of homosexuality were outlawed. In 1952 he was convicted of gross indecency and chemically castrated as part of his sentence. As a result of the treatment, he committed suicide in 1954.

"It's also a very concrete symbol of what the world has lost because of homosexual persecution," Hatton said. "Who knows what else he might have done? Or other people who were persecuted? Who knows what else the world has lost?"