added option to choose hash type in higher level function