Converting keyhash to buffer