forked from quic-go/quic-go
27 lines
629 B
Go
27 lines
629 B
Go
package crypto_test
|
|
|
|
import (
|
|
"github.com/lucas-clemente/quic-go/crypto"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("FNV", func() {
|
|
It("gives proper null hash", func() {
|
|
hash := crypto.New128a()
|
|
h, l := hash.Sum128()
|
|
Expect(l).To(Equal(uint64(0x62b821756295c58d)))
|
|
Expect(h).To(Equal(uint64(0x6c62272e07bb0142)))
|
|
})
|
|
|
|
It("calculates hash", func() {
|
|
hash := crypto.New128a()
|
|
_, err := hash.Write([]byte("foobar"))
|
|
Expect(err).ToNot(HaveOccurred())
|
|
h, l := hash.Sum128()
|
|
Expect(l).To(Equal(uint64(0x6f0d3597ba446f18)))
|
|
Expect(h).To(Equal(uint64(0x343e1662793c64bf)))
|
|
})
|
|
})
|