added HashAlloc function