Drop fastsha256 in favor of crypto/sha256
This commit is contained in:
parent
96e858f48e
commit
bca6409ade
2 changed files with 4 additions and 4 deletions
|
@ -6,6 +6,7 @@ package coinset_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -14,7 +15,6 @@ import (
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/btcutil/coinset"
|
"github.com/btcsuite/btcutil/coinset"
|
||||||
"github.com/btcsuite/fastsha256"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestCoin struct {
|
type TestCoin struct {
|
||||||
|
@ -32,7 +32,7 @@ func (c *TestCoin) NumConfs() int64 { return c.TxNumConfs }
|
||||||
func (c *TestCoin) ValueAge() int64 { return int64(c.TxValue) * c.TxNumConfs }
|
func (c *TestCoin) ValueAge() int64 { return int64(c.TxValue) * c.TxNumConfs }
|
||||||
|
|
||||||
func NewCoin(index int64, value btcutil.Amount, numConfs int64) coinset.Coin {
|
func NewCoin(index int64, value btcutil.Amount, numConfs int64) coinset.Coin {
|
||||||
h := fastsha256.New()
|
h := sha256.New()
|
||||||
h.Write([]byte(fmt.Sprintf("%d", index)))
|
h.Write([]byte(fmt.Sprintf("%d", index)))
|
||||||
hash, _ := chainhash.NewHash(h.Sum(nil))
|
hash, _ := chainhash.NewHash(h.Sum(nil))
|
||||||
c := &TestCoin{
|
c := &TestCoin{
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
package btcutil
|
package btcutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
"hash"
|
"hash"
|
||||||
|
|
||||||
"github.com/btcsuite/fastsha256"
|
|
||||||
"github.com/btcsuite/golangcrypto/ripemd160"
|
"github.com/btcsuite/golangcrypto/ripemd160"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,5 +19,5 @@ func calcHash(buf []byte, hasher hash.Hash) []byte {
|
||||||
|
|
||||||
// Hash160 calculates the hash ripemd160(sha256(b)).
|
// Hash160 calculates the hash ripemd160(sha256(b)).
|
||||||
func Hash160(buf []byte) []byte {
|
func Hash160(buf []byte) []byte {
|
||||||
return calcHash(calcHash(buf, fastsha256.New()), ripemd160.New())
|
return calcHash(calcHash(buf, sha256.New()), ripemd160.New())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue