Hashing implementation.
Changes to be made in Security class marked with comments.