Added base3 hash function