use hashlib and fallback to sha (for python 2.4)