Write ruby implementation of PolyPassHash with reference to python implementatoion