implement square hashing