forked from cerc-io/plugeth
crypto: Remove dead code
This commit is contained in:
parent
0c6665558a
commit
3d971c5a34
@ -68,7 +68,6 @@ func Sha3Hash(data ...[]byte) common.Hash { return Keccak256Hash(data...) }
|
|||||||
func CreateAddress(b common.Address, nonce uint64) common.Address {
|
func CreateAddress(b common.Address, nonce uint64) common.Address {
|
||||||
data, _ := rlp.EncodeToBytes([]interface{}{b, nonce})
|
data, _ := rlp.EncodeToBytes([]interface{}{b, nonce})
|
||||||
return common.BytesToAddress(Keccak256(data)[12:])
|
return common.BytesToAddress(Keccak256(data)[12:])
|
||||||
//return Sha3(common.NewValue([]interface{}{b, nonce}).Encode())[12:]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Sha256(data []byte) []byte {
|
func Sha256(data []byte) []byte {
|
||||||
|
@ -19,8 +19,6 @@ package randentropy
|
|||||||
import (
|
import (
|
||||||
crand "crypto/rand"
|
crand "crypto/rand"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/crypto/sha3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Reader io.Reader = &randEntropy{}
|
var Reader io.Reader = &randEntropy{}
|
||||||
@ -34,14 +32,6 @@ func (*randEntropy) Read(bytes []byte) (n int, err error) {
|
|||||||
return len(bytes), nil
|
return len(bytes), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: copied from crypto.go , move to sha3 package?
|
|
||||||
func Sha3(data []byte) []byte {
|
|
||||||
d := sha3.NewKeccak256()
|
|
||||||
d.Write(data)
|
|
||||||
|
|
||||||
return d.Sum(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetEntropyCSPRNG(n int) []byte {
|
func GetEntropyCSPRNG(n int) []byte {
|
||||||
mainBuff := make([]byte, n)
|
mainBuff := make([]byte, n)
|
||||||
_, err := io.ReadFull(crand.Reader, mainBuff)
|
_, err := io.ReadFull(crand.Reader, mainBuff)
|
||||||
|
Loading…
Reference in New Issue
Block a user