crypto/cleanup: remove unused functions

master
Harshavardhana 10 years ago
parent 179c5441c3
commit 2671b2dbf4
  1. 2
      pkg/crypto/sha256/sha256_linux.go
  2. 6
      pkg/crypto/sha256/sha256_windows.go
  3. 2
      pkg/crypto/sha256/sha256block_linux.go
  4. 11
      pkg/crypto/sha512/sha512_darwin.go
  5. 13
      pkg/crypto/sha512/sha512_linux.go
  6. 13
      pkg/crypto/sha512/sha512_windows.go
  7. 2
      pkg/crypto/sha512/sha512block_linux.go

@ -66,7 +66,7 @@ func block(dig *digest, p []byte) {
case cpu.HasSSE41() == true:
blockSSE(dig, p)
default:
blockSoftware(dig, p)
blockGeneric(dig, p)
}
}

@ -17,6 +17,7 @@
package sha256
import (
"hash"
"io"
"crypto/sha256"
@ -45,3 +46,8 @@ func Sum(reader io.Reader) ([]byte, error) {
}
return d.Sum(nil), nil
}
// New returns a new hash.Hash computing SHA256.
func New() hash.Hash {
return sha256.New()
}

@ -44,7 +44,7 @@ func blockAVX2(dig *digest, p []byte) {
C.sha256_transform_rorx((*C.char)(unsafe.Pointer(&p[0])), (*C.uint32_t)(unsafe.Pointer(&dig.h[0])), (C.ulong)(len(p)/64))
}
func blockSoftware(dig *digest, p []byte) {
func blockGeneric(dig *digest, p []byte) {
var w [64]uint32
h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]
for len(p) >= chunk {

@ -52,17 +52,6 @@ func Sum(reader io.Reader) ([]byte, error) {
return d.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [sha512.Size]byte
func SumStream(reader io.Reader) ([sha512.Size]byte, error) {
var returnValue [sha512.Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
}
// New returns a new hash.Hash computing SHA512.
func New() hash.Hash {
return sha512.New()

@ -53,7 +53,7 @@ func block(dig *digest, p []byte) {
case cpu.HasSSE41() == true:
blockSSE(dig, p)
default:
blockSoftware(dig, p)
blockGeneric(dig, p)
}
}
@ -182,14 +182,3 @@ func Sum(reader io.Reader) ([]byte, error) {
}
return h.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [Size]byte
func SumStream(reader io.Reader) ([Size]byte, error) {
var returnValue [Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
}

@ -17,6 +17,7 @@
package sha512
import (
"hash"
"io"
"crypto/sha512"
@ -51,13 +52,7 @@ func Sum(reader io.Reader) ([]byte, error) {
return d.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [sha512.Size]byte
func SumStream(reader io.Reader) ([sha512.Size]byte, error) {
var returnValue [sha512.Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
// New returns a new hash.Hash computing SHA512.
func New() hash.Hash {
return sha512.New()
}

@ -46,7 +46,7 @@ func blockAVX2(dig *digest, p []byte) {
C.sha512_transform_rorx(unsafe.Pointer(&p[0]), unsafe.Pointer(&dig.h[0]), (C.uint64_t)(len(p)/chunk))
}
func blockSoftware(dig *digest, p []byte) {
func blockGeneric(dig *digest, p []byte) {
var w [80]uint64
h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]
for len(p) >= chunk {

Loading…
Cancel
Save