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