Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerating a pseudo-natural phrase from a big integer in a reversible way
    text
    copied!<p>I have a large and "unique" integer (actually a SHA1 hash).</p> <p><strong>Note:</strong> While I'm talking here about SHA1 hashes, this is <strong>not</strong> a cryptography / security question! I'm <em>not</em> trying to break SHA1. Imagine a random 160-bit integer instead of SHA1 if that will help.</p> <p>I want (for no other reason than to have fun) to find an algorithm to map that SHA1 hash to a computer-generated (pseudo-)English phrase. The mapping should be bidirectional (i.e., knowing the algorithm, one must be able to calculate the original SHA1 hash from that phrase.)</p> <p>The phrase need not make sense. I would even settle for a whole paragraph of nonsense. (Though quality — englishness — of a paragraph should probably be better than for a mere phrase.)</p> <p>A better algorithm would produce shorter, more natural-looking, more unique phrases. </p> <p>A variation: it is OK if I will be able to work only with a part of hash. Say, first six hex digits is fine.</p> <p>The possible usage of the generated phrase: the human readable version of Git commit ID, to use as a motto for a given program version, which is built from that commit. (As I said, this is "for fun". I don't claim that this is very practical — or be much more readable than the SHA1 itself.)</p> <p><em>Possible approach: In the past I've attempted to build a probability table (of words), and generate phrases as Markov chains, seeding the generator (picking branches from probability tree), according to the bits I read from the SHA. This was not very successful, the resulting phrases were too long and ugly. I'm not sure if this was a bug, or the general flaw in the algorithm, since I had to abandon it early enough.</em></p> <p>Now I'm thinking about attempting to solve the problem once again. Any advice on how to approach this? <em>Do you think Markov chain approach can work here? Something else?</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload