applied cryptography - protocols, algorithms, and source code in c

Overview of one way hash functions its not easy to

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: of every keystroke — Mouse commands — The sector number, time of day, and seek latency for every disk operation — Actual mouse position — Number of current scanline of monitor — Contents of the actually displayed image — Contents of FATs, kernel tables, and so on — Access/modify times of /dev/tty — CPU load — Arrival times of network packets — Input from a microphone — /dev/audio without a microphone attached If your system uses separate crystal oscillators for its CPU and time-of-day clocks, try reading the time of day in a tight loop. On some (but not all) systems this will reflect the random phase jitter between the two oscillators. Since much of the randomness in these events is in their timing, use the most finely grained time-of-day clock you can find. A standard PC uses an Intel 8254 clock chip (or equivalent) driven at 1.1931818 megahertz, so reading the counter register directly gives you 838-nanosecond resolution. To avoid skewing the results, avoid taking your event samples on a timer interrupt. Here is the process in C with MD5 (see Section 18.5) as the hash function: char Randpool[16]; /* Call early and call often on a wide variety of random or semi* random system events to churn the randomness pool. * The exact format and length of randevent doesn’t matter as long as * its contents are at least somewhat unpredictable. */ void churnrand(char *randevent,unsigned int randlen) { MD5_CTX md5; MD5Init(&ampmd5); MD5Update(&ampmd5,Randpool,sizeof(Randpool)); MD5Update(&ampmd5,randevent,randlen); MD5Final(Randpool,&ampmd5); } After calling churnrand() enough to build up sufficient randomness in Randpool, you can now generate random bits from it. MD5 again comes in handy, this time as a counter-mode pseudo-random byte-stream generator. long Randcnt; void genrand(char *buf,unsigned int buflen) { MD5_CTX md5; char tmp[16]; unsigned int n; while(buflen != 0) { /* Hash the pool with a counter */ MD5Init(&ampmd5); MD5Update(&ampmd5,R...
View Full Document

This note was uploaded on 10/18/2010 for the course MATH CS 301 taught by Professor Aliulger during the Fall '10 term at Koç University.

Ask a homework question - tutors are online