...
Source file
src/crypto/sha512/fallback_test.go
1
2
3
4
5
6
7 package sha512
8
9 import (
10 "fmt"
11 "io"
12 "testing"
13 )
14
15
16
17
18 func TestGenericPath(t *testing.T) {
19 if !useAsm {
20 t.Skipf("assembly implementation unavailable")
21 }
22 useAsm = false
23 defer func() { useAsm = true }()
24 c := New()
25 in := "ΑΒΓΔΕϜΖΗΘΙΚΛΜΝΞΟΠϺϘΡΣΤΥΦΧΨΩ"
26 gold := "6922e319366d677f34c504af31bfcb29" +
27 "e531c125ecd08679362bffbd6b6ebfb9" +
28 "0dcc27dfc1f3d3b16a16c0763cf43b91" +
29 "40bbf9bbb7233724e9a0c6655b185d76"
30 if _, err := io.WriteString(c, in); err != nil {
31 t.Fatalf("could not write to c: %v", err)
32 }
33 out := fmt.Sprintf("%x", c.Sum(nil))
34 if out != gold {
35 t.Fatalf("mismatch: got %s, wanted %s", out, gold)
36 }
37 }
38
View as plain text