Casting to bytes when comparing hash