(CNN)A rare Enigma machine used by Nazi Germany during World War II was sold at auction Tuesday for 45,000 euros ($51,500).
The collector who put the machine up for sale at the Artmark auction house in Bucharest, Romania, had spotted it at a flea market in the city and bought it for just 100 euros ($114).
Vitally important to Nazi war efforts, the Enigma machine was used by the German military to encrypt messages into a form they believed was unbreakable.
But the code was cracked by a team of cryptologists at Bletchley Park in southern England -- a breakthrough widely credited with having shortened the war by at least two years.
The instrument sold Tuesday -- to an unnamed online bidder -- was made in Germany in 1941 and is in almost perfect condition, Vlad Georgescu, relationship manager at Artmark, told CNN.
"It belonged to a mathematician who has spent most of his life decrypting codes," he said. When he saw it for sale at the flea market, he immediately realized what it was and was "compelled to purchase it," he explained.
According to Georgescu, the previous owner simply did not realize the significance of the item -- he thought it was just a normal typewriter.
Once it was in his possession, the mathematician "started trying to figure out how the machine worked" and spent time cleaning and repairing it.
"He took great care of it," said Georgescu. And he is not surprised that the machine -- which had a starting price of 9,000 euros ($10,300) -- sold for such a large sum.
"These machines are very rare, especially entirely functional ones," he explained.
In 2011, an Enigma machine which featured in a Hollywood movie about the Bletchley Park codebreakers sold in London for £133,250 ($208,137), breaking all previous records.
World War II memorabilia of all kinds continues to attract bidders. Earlier this year, Adolf Hitler's telephone was sold in the US for $243,000 and a watch owned by Winston Churchill -- British Prime Minister during the war -- fetched £162,000 ($208,000) at auction in London, six times more than the estimate.