Postgres, Quasi-Random md5 generator

The goal was to create a random-ish string, then convert to md5 hash, to seed some database with initial hard-to-guess passwords.  I settled on this:

I’m drawing from Peter Eisentraut’s helpful tip to cast random() as text.  Additionally, I wanted the non-hashed data length to vary, so I concatenated with a random length string using a similar technique.

The result looks something like this, before hashing:

Hashed, of course, looks hashed.  Use your imagination.