You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
403 B
Go
25 lines
403 B
Go
package gnutls
|
|
|
|
import (
|
|
"bytes"
|
|
"crypto/sha512"
|
|
"encoding/hex"
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func TestHashSHA(t *testing.T) {
|
|
h := NewHash(GNUTLS_SHA512)
|
|
defer h.Close()
|
|
|
|
data := []byte("1234")
|
|
|
|
h1 := h.Sum(data)
|
|
|
|
h3 := sha512.Sum512(data)
|
|
if !bytes.Equal(h3[:], h1) {
|
|
log.Printf("\n%s\n%s", hex.EncodeToString(h3[:]), hex.EncodeToString(h1))
|
|
t.Fatal("hash not equal")
|
|
}
|
|
}
|