添加 github.com/pion/dtls 代码

This commit is contained in:
bjdgyc
2021-05-21 19:03:00 +08:00
parent 54a0cb7928
commit 28b5119f50
380 changed files with 16870 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package hash
import (
"testing"
"github.com/pion/dtls/v2/pkg/crypto/fingerprint"
)
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)
if err != nil {
t.Fatalf("fingerprint.HashFromString failed: %v", err)
}
if hash1 != hash2 {
t.Errorf("Hash algorithm mismatch, input: %d, after roundtrip: %d", int(hash1), int(hash2))
}
}
}