1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package hash
import (
"testing"
"github.com/pion/dtls/v3/pkg/crypto/fingerprint"
"github.com/stretchr/testify/assert"
)
func TestHashAlgorithm_StringRoundtrip(t *testing.T) {
for algo := range Algorithms() {
if algo == Ed25519 || algo == None {
continue
}
str := algo.String()
hash1 := algo.CryptoHash()
hash2, err := fingerprint.HashFromString(str)
assert.NoError(t, err)
assert.Equal(t, hash1, hash2)
}
}
|