Three different ways of generating a 32-character random hex string on the unix/linux/bsd command line. 1. Using built-in shell tool `od' and device file /dev/urandom $ od -N 16 -t xL /dev/urandom | grep -oE '[0-9a-f]{16}' | tr -d '\n' | xargs echo 2. Using package `openssl' (Install on OS X using MacPorts: "sudo port install openssl") $ openssl rand -hex 16 3. With a C program accessing /dev/urandom #include int main(void) { const char hex[] = "0123456789abcdef"; int len = 16, byte; FILE *fp = fopen("/dev/urandom", "r"); if (fp) { while (len--) { byte = getc(fp); putc(hex[byte >> 4], stdout); putc(hex[byte & 0xf], stdout); } fclose(fp); putc('\n', stdout); } return 0; }