# Seemingly simple (?) decryption question

Forgive the very novice question, but...

Given an algorithm which, upon inputting an unchanging 4-character string, generates a variable 6-character string, but having no idea what the algorithm is other than it is at least partially based on the date, is it possible/practical to discover the algorithm based on 15 or 20 previous results? I guess this would be "known-plaintext"?

How would you go about experimenting with this? Are there programs or calculators out there that would attempt to "crack the code" given a list of right answers?

Given the small number of input characters and output characters, each limited to the letters of the alphabet, it doesn't seem to me that it would be a terribly complex or unbreakable algorithm. Still, I'm a novice, I don't know where to start.

Is it doable or am I wasting my time?

Additional info: The four-character code is constant per machine; on another machine the four-character code would be different, but each machine would have an unchanging four-character code. The six-character code, generated using the four-character code, allows a machine access to the device for a variable length of time, after which point another six-character code is required.

The four-character code is always four characters; the output code always six characters. All alphabet, no numbers or symbols. I don't think it's case-sensitive. I do not know if the codes expire if not used immediately.

So give it up, huh? So even if I had a thousand previous results, still not doable?

Are there additional clues I could try to find out that would turn it from not doable to maybe doable?

-
Does it take a variable-length input and always output six characters? Or does the length of the output vary with the input? Also, if you try the same string back-to-back, are the results different, or do you wait a few seconds before they change? –  Reid Jun 30 at 3:44
This isn't a known plaintext attack. It's not really cryptography at all. What you're trying to do is reverse engineering, and would likely be better off in a different forum. –  Antimony Jul 3 at 6:31

If I interpret your question correctly, your unchanging 4-character input is probably just a PIN code that unlocks the use of the device. In this case, the sequence of 6-character strings is a series of one-time password to unlock access to a remote device.

Under this assumption, they is no simple way to predict the rest of the sequence. Indeed, it is easy to design secure device of this type. A simple solution is to output a hash of some inner state and then update the state using a secret key algorithm keyed with a key shared by the device and its remote partner. The most difficult issue is to solve desynchronization problems (e.g. what happens if you advance your local device 1000 times without transmitting anything, will the 1001-th code work ?)

Of course, it is also possible to construct insecure devices of this type. So if you have luck your exact device might be attackable.

However, the short answer is: no, in general, this is not doable.

-
password $\mapsto$ passwords $\:$ –  Ricky Demer Jun 30 at 10:41