There are few people who can bring the suspense and tension of a John Grisham courtroom drama to an analysis of mathematical formulae. But particle physicist turned writer Simon Singh did it with Fermat's Last Theorem. And he's pulled it off a second time with this book on cryptography. But The Codebook is more than an unusually entertaining account of mathematics applied to secrecy - it became a news item in itself.
The appendix to the book, which catalogues the history and development of ciphers and codes, included The Cipher Challenge, which consisted of a series of 10 ciphers each getting progressively more difficult to crack. The final example was intended to be the toughest public cipher challenge ever set, but in the age of the computer hacker this was the proverbial red rag to a bull.
On 7 October, Singh confirmed that the final stage in his Cipher Challenge had been translated into plain text. The news came just one week after the first anniversary of the competition had passed - a fluke of timing that actually cost Singh £1000.
Singh put £10,000 of his own money up as a prize to entice would-be cryptographers to crack his ciphers. He promised that if the final text had not been translated at the end of a year, he would pay £1000 to the leading challenger at that stage.
It was a group of Swedish researchers that eventually cracked the final text, which had been encoded using a 512bit encryption key similar to those used for internet security.
The Stockholm-based researchers - Fredrik Almgren, Gunnar Andersson, Torbjorn Granlund, Lars Ivansson and Staffan Ulfberg - say that they have not yet decided what they will do with the prize money.
The book could be seen as fairly damning evidence of mankind's paranoia. But in fact it's a fascinating journey that chronicles the increasingly sophisticated methods people use to hide information from one another, ranging from military secrets to communications between illicit lovers.
Singh describes the development of more complex enciphering techniques as a form of evolution. The term is appropriate, he says, because today's ciphers are the result of an intellectual arms race between the code makers and the code breakers.
He writes in an anecdotal and informal style aimed at the non-specialist, and generally manages to keep the pace of the narrative going while he explains some tricky technical concepts. It's not quite as fluid as Fermat's Last Theorem, but the subject matter is probably more accessible.
Singh does not get bogged down in deep mathematics, nor does he confine himself solely to ciphers and codes. He tells the story of the deciphering of the Rosetta Stone, and of Linear B, the language of the Minoan civilisation.
Native American code
He also recounts the fascinating tale of the Navajo Talkers. These were the men employed by the US military during the Second World War to maintain secure communications. The language confounded all attempts to decipher it because it is utterly distinct from any European or Asian language.
Despite the fact that the challenges at the end of the book have already been cracked, it is well worth a read, and the ciphers can still be attempted even if it is only for their entertainment value.
The challenges included a number of different techniques: classic and homophonic substitution, a range of ciphers known as Caesar, Vigenere, book, Playfair, ADFGVX and Enigma, and two computer ciphers known as DES and RSA.
The earlier ciphers were broken very quickly, the first falling on 1 September 1999, but the Swedes said that the one they found most difficult was stage five, a book cipher.
"I really didn't have the foggiest idea how long it would take to be solved, but I think a year is a good time. If it had gone on for longer, say five years or so, it would have become frustrating and would have lost its pace. It is very hard to set a cipher that isn't either trivial or impossible," said Singh.
His thoughts were echoed by Paul Leyland, his colleague in this endeavour. Leyland is an encryption specialist working at Microsoft's research labs in Cambridge who helped Singh to design the ciphers - by all accounts a difficult task.
As for the timing, the cracking of the cipher coincided with the start of Singh's TV serialisation of the book. It would seem that this was actually pure coincidence, and Singh admitted rather wistfully that he would have liked it to be cracked a little earlier. "It would have saved me a thousand pounds," he said.
Because the ciphers in the challenge had been following a historical theme, the final stage had to be a realistic application of public key cryptography.
Leyland explains. "The archetypal public key algorithm is RSA, and one of its major uses in real life is to encrypt a cipher key. The key would then be used to encrypt a message with a cipher far too hard to break by key search, as for the DES stage. We chose triple-DES for the cipher, and encrypted its 112bit key with a RSA public key, which was 512bits in size."
It was the implications of such a strong cipher being broken without the use of a super computer that really impressed Leyland and Singh. The researchers wrote a number field sieve algorithm that was able to run on an ordinary machine but, as it turned out, the final cipher had an altogether unexpected trick up its sleeve.
"The last text was supposed to be triple DES encrypted," said Singh. "This is impossible to crack, but we had encrypted the key to the passage with a 512bit asymmetric cipher, and this was the way to solve the final stage."
But inadvertently, Singh only used single DES. The plain text of stage nine had hinted very strongly that the final passage had been encrypted using triple DES. So the Swedes used the key to 'un-triple DES' the passage.
It still made no sense, but Granlund, one of the researchers, said that the group had not been too discouraged.
The cryptography of spelling
"It took them a couple of hours to work out what was going on," Singh remarked. "I'm not embarrassed by it - it's just part of cryptography that things are not always perfect. I'm sure there were spelling mistakes running through all the other texts as well."
None of this means that systems are no longer secure, but it does serve as a timely reminder that it is important to keep an eye on the strength of encryption algorithms.
So what are the Swedes up to now? "We are getting back to boring work stuff again, but that pays better than £10,000 a year. In our spare time, Staffan and I are looking into speeding up certain aspects of the NFS factoring algorithm. Within the next year, we hope to have some interesting factoring results that should scare RSA users into using even larger key sizes."
The Swedes' own story of the efforts to decipher the 10 stages is told at www.codebook.org
The Codebook by Simon Singh is published in hardback by Fourth Estate, priced at £16.99. ISBN 1-85702-879-1.
The skeleton was unearthed more than 20 years ago in South Africa
Moon's dark side is mountainous, rugged and never visible from the Earth
The groundwater basins in some areas of Tehran have been damaged irreversibly
This is the first time that any spacecraft on Mars has recorded air vibrations on the planet