four kinds of hash 1. corned beef 2. smoke 3. non-security hash - java.lang.String hashcode, FNV e.g. 16-bit hash, array size 65536, h=hash(string), a[h] = list of strings n-bit hash, P(collison)>=0.5 with approx sqrt(2**n) = 2**(n/2) input strings 4. secure hash algorithm or message digest, P(collision) ~= 0, one-way function --- $ make gcc -std=c11 -pedantic -Wall -DPART1 -o fork1 fork.c gcc -std=c11 -pedantic -Wall -o fork2 fork.c gcc -std=c11 -pedantic -Wall -DPART1 -o pthread1 pthread.c -pthread gcc -std=c11 -pedantic -Wall -o pthread2 pthread.c -pthread $ ./fork1 parent 22873 1 child 22874 1 child 22874 2 parent 22873 2 child 22874 3 child 22874 4 parent 22873 3 child 22874 5 -rw-r--r-- 1 perry perry 336 Nov 29 05:30 Makefile parent 22873 4 parent 22873 5 $ ./pthread1 main 22886 1 f 22886 2 f 22886 3 main 22886 4 f 22886 5 f 22886 6 main 22886 7 f 22886 8 main 22886 9 main 22886 10 $ ./fork2 parent got: hi from child s = 16896, exit = 66 $ ./pthread2 main got: hi from f *v = 99 $ make clean rm -f a.out core fork1 fork2 pthread1 pthread2 $