Updated

It was a world-class stroke of good luck. An antique "typewriter" snapped up by an eagle-eyed expert in Romania for about $114 at a flea market turned out to be a rare Nazi Enigma cipher machine, CNN reports.

The German Wehrmacht Enigma I sold for $51,500 to an anonymous bidder at an auction in Bucharest on Tuesday. During World War II, the German military used the machine to encrypt and decrypt sensitive messages.

Depicted in the 2014 movie Imitation Game, dogged English cryptologists at Bletchley Park cracked the code, which the Germans believed unbreakable. Their work was said to have shortened the war by two years.

The collector who spotted the rare machine was a cryptography professor who "knew very well what he was buying," Cristian Gavrila of Artmark auction house tells Reuters.

Alas, the flea market seller, who thought it an ordinary old typewriter, did not. Romania was an ally of the Nazis until 1944, and historians believe there may be more Enigmas lying undiscovered in attics there.

Thousands of machines were produced but very few have come up for sale, per CNN. But the latest sale isn't the biggest by far: A 1944 Enigma machine sold at Christie's New York last month for a record $547,500.

Before that, an Enigma machine featured in the 2001 Kate Winslet film Enigma sold in London for $208,137. (Adolf Hitler's purported red phone sold for $243,000.)

This article originally appeared on Newser: $114 Flea Market Find, Nazi Code Machine Sells for $51K