add length attribute to hash function