Renamed Sha3Bin to Sha3
This commit is contained in:
+2
-3
@@ -1,7 +1,6 @@
|
||||
package ethcrypto
|
||||
|
||||
import (
|
||||
//"code.google.com/p/go.crypto/sha3"
|
||||
"crypto/sha256"
|
||||
|
||||
"code.google.com/p/go.crypto/ripemd160"
|
||||
@@ -12,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// TODO refactor, remove (bin)
|
||||
func Sha3Bin(data []byte) []byte {
|
||||
func Sha3(data []byte) []byte {
|
||||
d := sha3.NewKeccak256()
|
||||
d.Write(data)
|
||||
|
||||
@@ -21,7 +20,7 @@ func Sha3Bin(data []byte) []byte {
|
||||
|
||||
// Creates an ethereum address given the bytes and the nonce
|
||||
func CreateAddress(b []byte, nonce uint64) []byte {
|
||||
return Sha3Bin(ethutil.NewValue([]interface{}{b, nonce}).Encode())[12:]
|
||||
return Sha3(ethutil.NewValue([]interface{}{b, nonce}).Encode())[12:]
|
||||
}
|
||||
|
||||
func Sha256(data []byte) []byte {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package ethcrypto
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/eth-go/ethutil"
|
||||
"github.com/obscuren/secp256k1-go"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type KeyPair struct {
|
||||
@@ -32,7 +33,7 @@ func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) {
|
||||
|
||||
func (k *KeyPair) Address() []byte {
|
||||
if k.address == nil {
|
||||
k.address = Sha3Bin(k.PublicKey[1:])[12:]
|
||||
k.address = Sha3(k.PublicKey[1:])[12:]
|
||||
}
|
||||
return k.address
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user