partial rolling_hash method