I've been whiling away the evening hours writing a set of cryptography functions for PostgreSQL. First in importance, but the last thing I wrote, is a cryptographically strong pseudorandom number generator. I chose to implement the Blum Blum Shub algorithm. My attraction to this algorithm lies in the fact that it is supported by a security proof very similar to that behind the RSA PKCS #1 v2.1 standard, which relates to the difficulty of factoring large integers. This algorithm has been subjected to lengthy and intense scrutiny, and has withstood the test of time. This code is available to use under the terms of the GNU Affero GPL v3.0.