2015-03-06 04:50:51 -05:00
|
|
|
package md5_test
|
2014-12-20 19:01:27 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"encoding/hex"
|
|
|
|
"testing"
|
|
|
|
|
2015-04-04 16:37:30 -04:00
|
|
|
. "github.com/minio-io/check"
|
2015-03-06 04:50:51 -05:00
|
|
|
"github.com/minio-io/minio/pkg/utils/crypto/md5"
|
2014-12-20 19:01:27 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test(t *testing.T) { TestingT(t) }
|
|
|
|
|
|
|
|
type MySuite struct{}
|
|
|
|
|
|
|
|
var _ = Suite(&MySuite{})
|
|
|
|
|
|
|
|
func (s *MySuite) TestMd5sum(c *C) {
|
|
|
|
testString := []byte("Test string")
|
|
|
|
expectedHash, _ := hex.DecodeString("0fd3dbec9730101bff92acc820befc34")
|
2015-03-06 04:50:51 -05:00
|
|
|
hash, err := md5.Sum(bytes.NewBuffer(testString))
|
2014-12-20 19:01:27 -05:00
|
|
|
c.Assert(err, IsNil)
|
|
|
|
c.Assert(bytes.Equal(expectedHash, hash), Equals, true)
|
|
|
|
}
|