public string ComputePackedHashString(string secret, int hashAlgorithm, int iterations, int saltSizeInBytes)
        {
            var hasher       = _secureHasherProvider.GetHasher(hashAlgorithm);
            var packedHash   = hasher.ComputeHash(secret, hashAlgorithm, iterations, saltSizeInBytes);
            var base64String = _packedHashConverter.GetBase64String(packedHash);

            return(base64String);
        }
        public bool VerifySecret(string key, string presentedSecret, ApiClientSecret actualSecret)
        {
            if (!actualSecret.IsHashed)
            {
                return(presentedSecret == actualSecret.Secret);
            }

            var actualHash = _packedHashConverter.GetPackedHash(actualSecret.Secret);
            var hasher     = _secureHasherProvider.GetHasher(actualHash.HashAlgorithm);

            var presentedHash = hasher.ComputeHash(
                presentedSecret, actualHash.HashAlgorithm, actualHash.Iterations, actualHash.Salt);

            return(ByteArraysEqual(actualHash.HashBytes, presentedHash.HashBytes));
        }