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