You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
467 B
24 lines
467 B
10 years ago
|
package sha1
|
||
|
|
||
|
import (
|
||
10 years ago
|
"bytes"
|
||
|
"encoding/hex"
|
||
10 years ago
|
"testing"
|
||
10 years ago
|
|
||
|
. "gopkg.in/check.v1"
|
||
10 years ago
|
)
|
||
|
|
||
|
func Test(t *testing.T) { TestingT(t) }
|
||
|
|
||
|
type MySuite struct{}
|
||
|
|
||
|
var _ = Suite(&MySuite{})
|
||
|
|
||
10 years ago
|
func (s *MySuite) TestStreamingSha1(c *C) {
|
||
|
testString := []byte("Test string")
|
||
|
expectedHash, _ := hex.DecodeString("18af819125b70879d36378431c4e8d9bfa6a2599")
|
||
|
hash, err := Sum(bytes.NewBuffer(testString))
|
||
|
c.Assert(err, IsNil)
|
||
|
c.Assert(bytes.Equal(expectedHash, hash), Equals, true)
|
||
|
}
|