n-gram hash