Developer's Daily | Unix by Example |
main | java | perl | unix | dev directory | web log |
mcookie ? generate magic cookies for xauth |
mcookie [?v] [?f filename ] |
mcookie generates a 128-bit random hexadecimal number for use with the X authority system. Typical usage: |
xauth add :0 . ‘mcookie‘ |
The "random" number generated is actually the output of the MD5 message digest fed with various piece of random information: the current time, the process id, the parent process id, the contents of an input file (if ?f is specified), and several bytes of information from the first of the following devices which is present: /dev/random, /dev/urandom, files in /proc, /dev/audio. |
The entropy in the generated 128-bit is probably quite small (and, therefore, vulnerable to attack) unless a non-pseudorandom number generator is used (e.g., /dev/random under Linux). It is assumed that none of the devices opened will block. |
/dev/random |
X(1), xauth(1), md5sum(1) |