working hash and encrypt code