changed the salt generation to more reliable method