Haskell-Data-Analysis-Cookbook/Ch04
Tong-Kiat Tan 8f9c4d2b23 Combined two styles: pattern-matching vs if-then-else
Pattern matching (from book), if-then-else (from original code)
2014-08-10 09:03:14 +08:00
..
Code01_primitive Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code02_data Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code03_crypto1 Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code04_crypto2 Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code05_stable Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code06_hashmap Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code07_city Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code08_geo Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code09_bloom Removed unnecessary code 2014-08-09 16:10:28 +08:00
Code10_murmur Added Ch 5, fixed Ch 4 2014-06-13 00:33:05 -04:00
Code11_phash Combined two styles: pattern-matching vs if-then-else 2014-08-10 09:03:14 +08:00
LICENSE Added Chapter 4 2014-06-12 23:49:44 -04:00
README.md Added Chapter 4 2014-06-12 23:49:44 -04:00

Chapter 4

Chapter 4, Data Hashing, covers essential hashing functions such as MD5, SHA256, GeoHashing, and perceptual hashing.

This is the accompanying source code for Haskell Data Analysis Cookbook. Refer to the book for step-by-step explanations.

Recipes

  • Code01: Hashing a primitive data type
  • Code02: Hashing a custom data type
  • Code03: Running popular cryptographic hash functions
  • Code04: Running a cryptographic checksum on a file
  • Code05: Performing fast comparisons between data types
  • Code06: Using a high-performance hash table
  • Code07: Using Google's CityHash hash functions for strings
  • Code08: Computing Geohash for location coordinates
  • Code09: Using a bloom filter to remove unique items
  • Code10: Running MurmurHash, a simple but speedy hashing algorithm
  • Code11: Measuring image similarity with perceptual hashes

How to use

Setting up the environment

Install the Haskell Platform.

$ sudo apt-get install haskell-platform

Alternatively, install GHC 7.6 (or above) and Cabal.

$ sudo apt-get install ghc cabal-install

Running the code

A Makefile is provided in each recipe. Compile the corresponding executable by running make.

$ make

Run the resulting code. For example,

$ ./Code01

To clean up the directory:

$ make clean