small rewrite of MD5