move hashlib functions to model