aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-31 19:37:43 +0800
committerobscuren <geffobscura@gmail.com>2014-10-31 19:37:43 +0800
commitfd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b (patch)
tree5f60296ff025ec08962cdd2b4f6bbcfd1479cfdb
parent3ee0461cb5b6e4a5e2d287180afbdb681805a662 (diff)
downloadgo-tangerine-fd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b.tar.gz
go-tangerine-fd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b.tar.zst
go-tangerine-fd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b.zip
ethcrypto => crypto
-rw-r--r--chain/block.go10
-rw-r--r--chain/dagger.go4
-rw-r--r--chain/genesis.go6
-rw-r--r--chain/state_manager.go4
-rw-r--r--chain/transaction.go12
-rw-r--r--cmd/ethereum/main.go4
-rw-r--r--cmd/mist/ui_lib.go4
-rw-r--r--crypto/crypto.go (renamed from ethcrypto/crypto.go)2
-rw-r--r--crypto/crypto_test.go (renamed from ethcrypto/crypto_test.go)2
-rw-r--r--crypto/key_manager.go (renamed from ethcrypto/key_manager.go)2
-rw-r--r--crypto/key_store.go (renamed from ethcrypto/key_store.go)2
-rw-r--r--crypto/keypair.go (renamed from ethcrypto/keypair.go)2
-rw-r--r--crypto/keyring.go (renamed from ethcrypto/keyring.go)2
-rw-r--r--crypto/keys_test.go (renamed from ethcrypto/keys_test.go)2
-rw-r--r--crypto/mnemonic.go (renamed from ethcrypto/mnemonic.go)2
-rw-r--r--crypto/mnemonic_test.go (renamed from ethcrypto/mnemonic_test.go)2
-rw-r--r--crypto/mnemonic_words.go (renamed from ethcrypto/mnemonic_words.go)2
-rw-r--r--ethereum.go8
-rw-r--r--ethpipe/js_pipe.go10
-rw-r--r--ethpipe/js_types.go4
-rw-r--r--ethpipe/pipe.go8
-rw-r--r--ethstate/state_object.go4
-rw-r--r--ethtrie/trie.go6
-rw-r--r--utils/cmd.go14
-rw-r--r--vm/address.go8
-rw-r--r--vm/vm.go6
-rw-r--r--vm/vm_debug.go6
27 files changed, 69 insertions, 69 deletions
diff --git a/chain/block.go b/chain/block.go
index 17a19d391..abad6f3d2 100644
--- a/chain/block.go
+++ b/chain/block.go
@@ -7,7 +7,7 @@ import (
"sort"
"time"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
@@ -144,12 +144,12 @@ func CreateBlock(root interface{},
// Returns a hash of the block
func (block *Block) Hash() ethutil.Bytes {
- return ethcrypto.Sha3(ethutil.NewValue(block.header()).Encode())
- //return ethcrypto.Sha3(block.Value().Encode())
+ return crypto.Sha3(ethutil.NewValue(block.header()).Encode())
+ //return crypto.Sha3(block.Value().Encode())
}
func (block *Block) HashNoNonce() []byte {
- return ethcrypto.Sha3(ethutil.Encode(block.miningHeader()))
+ return crypto.Sha3(ethutil.Encode(block.miningHeader()))
}
func (block *Block) State() *ethstate.State {
@@ -232,7 +232,7 @@ func (block *Block) rlpUncles() interface{} {
func (block *Block) SetUncles(uncles []*Block) {
block.Uncles = uncles
- block.UncleSha = ethcrypto.Sha3(ethutil.Encode(block.rlpUncles()))
+ block.UncleSha = crypto.Sha3(ethutil.Encode(block.rlpUncles()))
}
func (self *Block) SetReceipts(receipts Receipts) {
diff --git a/chain/dagger.go b/chain/dagger.go
index bb6b136f6..66fbbcde4 100644
--- a/chain/dagger.go
+++ b/chain/dagger.go
@@ -6,7 +6,7 @@ import (
"math/rand"
"time"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/obscuren/sha3"
@@ -60,7 +60,7 @@ func (pow *EasyPow) Search(block *Block, stop <-chan struct{}) []byte {
t = time.Now()
}
- sha := ethcrypto.Sha3(big.NewInt(r.Int63()).Bytes())
+ sha := crypto.Sha3(big.NewInt(r.Int63()).Bytes())
if pow.Verify(hash, diff, sha) {
return sha
}
diff --git a/chain/genesis.go b/chain/genesis.go
index 2f3b1919b..3a552f583 100644
--- a/chain/genesis.go
+++ b/chain/genesis.go
@@ -3,7 +3,7 @@ package chain
import (
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -14,7 +14,7 @@ import (
var ZeroHash256 = make([]byte, 32)
var ZeroHash160 = make([]byte, 20)
var ZeroHash512 = make([]byte, 64)
-var EmptyShaList = ethcrypto.Sha3(ethutil.Encode([]interface{}{}))
+var EmptyShaList = crypto.Sha3(ethutil.Encode([]interface{}{}))
var GenesisHeader = []interface{}{
// Previous hash (none)
@@ -47,7 +47,7 @@ var GenesisHeader = []interface{}{
// Extra
nil,
// Nonce
- ethcrypto.Sha3(big.NewInt(42).Bytes()),
+ crypto.Sha3(big.NewInt(42).Bytes()),
}
var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}}
diff --git a/chain/state_manager.go b/chain/state_manager.go
index f78eb925a..9f7a4a0fd 100644
--- a/chain/state_manager.go
+++ b/chain/state_manager.go
@@ -9,7 +9,7 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@@ -40,7 +40,7 @@ type EthManager interface {
IsMining() bool
IsListening() bool
Peers() *list.List
- KeyManager() *ethcrypto.KeyManager
+ KeyManager() *crypto.KeyManager
ClientIdentity() ethwire.ClientIdentity
Db() ethutil.Database
EventMux() *event.TypeMux
diff --git a/chain/transaction.go b/chain/transaction.go
index ef95432af..416ffbc6c 100644
--- a/chain/transaction.go
+++ b/chain/transaction.go
@@ -5,7 +5,7 @@ import (
"fmt"
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/obscuren/secp256k1-go"
@@ -66,7 +66,7 @@ func (self *Transaction) TotalValue() *big.Int {
func (tx *Transaction) Hash() []byte {
data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data}
- return ethcrypto.Sha3(ethutil.NewValue(data).Encode())
+ return crypto.Sha3(ethutil.NewValue(data).Encode())
}
func (tx *Transaction) CreatesContract() bool {
@@ -80,9 +80,9 @@ func (tx *Transaction) IsContract() bool {
func (tx *Transaction) CreationAddress(state *ethstate.State) []byte {
// Generate a new address
- addr := ethcrypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:]
+ addr := crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:]
//for i := uint64(0); state.GetStateObject(addr) != nil; i++ {
- // addr = ethcrypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
+ // addr = crypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
//}
return addr
@@ -106,7 +106,7 @@ func (tx *Transaction) PublicKey() []byte {
sig := append(r, s...)
sig = append(sig, tx.v-27)
- pubkey := ethcrypto.Ecrecover(append(hash, sig...))
+ pubkey := crypto.Ecrecover(append(hash, sig...))
//pubkey, _ := secp256k1.RecoverPubkey(hash, sig)
return pubkey
@@ -121,7 +121,7 @@ func (tx *Transaction) Sender() []byte {
return nil
}
- return ethcrypto.Sha3(pubkey[1:])[12:]
+ return crypto.Sha3(pubkey[1:])[12:]
}
func (tx *Transaction) Sign(privk []byte) error {
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index b78d49cae..71b9b72f1 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -22,7 +22,7 @@ import (
"os"
"runtime"
- "github.com/ethereum/go-ethereum/ethchain"
+ "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/utils"
@@ -74,7 +74,7 @@ func main() {
ethereum := utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer)
if Dump {
- var block *ethchain.Block
+ var block *chain.Block
if len(DumpHash) == 0 && DumpNumber == -1 {
block = ethereum.ChainManager().CurrentBlock
diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go
index a9b560b6f..b12fab603 100644
--- a/cmd/mist/ui_lib.go
+++ b/cmd/mist/ui_lib.go
@@ -26,7 +26,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@@ -69,7 +69,7 @@ func (self *UiLib) LookupDomain(domain string) string {
world := self.World()
if len(domain) > 32 {
- domain = string(ethcrypto.Sha3([]byte(domain)))
+ domain = string(crypto.Sha3([]byte(domain)))
}
data := world.Config().Get("DnsReg").StorageString(domain).Bytes()
diff --git a/ethcrypto/crypto.go b/crypto/crypto.go
index 068e066d5..e10a9e81f 100644
--- a/ethcrypto/crypto.go
+++ b/crypto/crypto.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"crypto/sha256"
diff --git a/ethcrypto/crypto_test.go b/crypto/crypto_test.go
index e8db6362f..af62a02a2 100644
--- a/ethcrypto/crypto_test.go
+++ b/crypto/crypto_test.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"bytes"
diff --git a/ethcrypto/key_manager.go b/crypto/key_manager.go
index 109768423..cc2b9ff90 100644
--- a/ethcrypto/key_manager.go
+++ b/crypto/key_manager.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"fmt"
diff --git a/ethcrypto/key_store.go b/crypto/key_store.go
index 14d11011f..04560a04e 100644
--- a/ethcrypto/key_store.go
+++ b/crypto/key_store.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"fmt"
diff --git a/ethcrypto/keypair.go b/crypto/keypair.go
index 613f65d8c..d02875ded 100644
--- a/ethcrypto/keypair.go
+++ b/crypto/keypair.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"strings"
diff --git a/ethcrypto/keyring.go b/crypto/keyring.go
index 35733808b..eab13dbc4 100644
--- a/ethcrypto/keyring.go
+++ b/crypto/keyring.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"fmt"
diff --git a/ethcrypto/keys_test.go b/crypto/keys_test.go
index 8aedc1ee1..46e40110c 100644
--- a/ethcrypto/keys_test.go
+++ b/crypto/keys_test.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"github.com/ethereum/go-ethereum/ethdb"
diff --git a/ethcrypto/mnemonic.go b/crypto/mnemonic.go
index 5fb620219..0d690f245 100644
--- a/ethcrypto/mnemonic.go
+++ b/crypto/mnemonic.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"fmt"
diff --git a/ethcrypto/mnemonic_test.go b/crypto/mnemonic_test.go
index 8bd8859ae..beff476e0 100644
--- a/ethcrypto/mnemonic_test.go
+++ b/crypto/mnemonic_test.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
import (
"testing"
diff --git a/ethcrypto/mnemonic_words.go b/crypto/mnemonic_words.go
index 72f0ad48f..ebd0d2690 100644
--- a/ethcrypto/mnemonic_words.go
+++ b/crypto/mnemonic_words.go
@@ -1,4 +1,4 @@
-package ethcrypto
+package crypto
var MnemonicWords []string = []string{
"like",
diff --git a/ethereum.go b/ethereum.go
index 489e88b8a..4f2ca85e8 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -15,7 +15,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@@ -86,7 +86,7 @@ type Ethereum struct {
RpcServer *rpc.JsonRpcServer
- keyManager *ethcrypto.KeyManager
+ keyManager *crypto.KeyManager
clientIdentity ethwire.ClientIdentity
@@ -97,7 +97,7 @@ type Ethereum struct {
filters map[int]*chain.Filter
}
-func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager *ethcrypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error) {
+func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager *crypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error) {
var err error
var nat NAT
@@ -138,7 +138,7 @@ func New(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager
return ethereum, nil
}
-func (s *Ethereum) KeyManager() *ethcrypto.KeyManager {
+func (s *Ethereum) KeyManager() *crypto.KeyManager {
return s.keyManager
}
diff --git a/ethpipe/js_pipe.go b/ethpipe/js_pipe.go
index ee4637d8f..deb3cf091 100644
--- a/ethpipe/js_pipe.go
+++ b/ethpipe/js_pipe.go
@@ -6,7 +6,7 @@ import (
"sync/atomic"
"github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -114,7 +114,7 @@ func (self *JSPipe) IsContract(address string) bool {
}
func (self *JSPipe) SecretToAddress(key string) string {
- pair, err := ethcrypto.NewKeyPairFromSec(ethutil.Hex2Bytes(key))
+ pair, err := crypto.NewKeyPairFromSec(ethutil.Hex2Bytes(key))
if err != nil {
return ""
}
@@ -192,12 +192,12 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
}
}
- var keyPair *ethcrypto.KeyPair
+ var keyPair *crypto.KeyPair
var err error
if ethutil.IsHex(key) {
- keyPair, err = ethcrypto.NewKeyPairFromSec([]byte(ethutil.Hex2Bytes(key[2:])))
+ keyPair, err = crypto.NewKeyPairFromSec([]byte(ethutil.Hex2Bytes(key[2:])))
} else {
- keyPair, err = ethcrypto.NewKeyPairFromSec([]byte(ethutil.Hex2Bytes(key)))
+ keyPair, err = crypto.NewKeyPairFromSec([]byte(ethutil.Hex2Bytes(key)))
}
if err != nil {
diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go
index 94019f275..3daf015ca 100644
--- a/ethpipe/js_types.go
+++ b/ethpipe/js_types.go
@@ -6,7 +6,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -119,7 +119,7 @@ type JSKey struct {
PublicKey string `json:"publicKey"`
}
-func NewJSKey(key *ethcrypto.KeyPair) *JSKey {
+func NewJSKey(key *crypto.KeyPair) *JSKey {
return &JSKey{ethutil.Bytes2Hex(key.Address()), ethutil.Bytes2Hex(key.PrivateKey), ethutil.Bytes2Hex(key.PublicKey)}
}
diff --git a/ethpipe/pipe.go b/ethpipe/pipe.go
index 7dd6ae262..7663a1984 100644
--- a/ethpipe/pipe.go
+++ b/ethpipe/pipe.go
@@ -5,7 +5,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@@ -77,7 +77,7 @@ func (self *Pipe) Storage(addr, storageAddr []byte) *ethutil.Value {
}
func (self *Pipe) ToAddress(priv []byte) []byte {
- pair, err := ethcrypto.NewKeyPairFromSec(priv)
+ pair, err := crypto.NewKeyPairFromSec(priv)
if err != nil {
return nil
}
@@ -89,7 +89,7 @@ func (self *Pipe) Exists(addr []byte) bool {
return self.World().Get(addr) != nil
}
-func (self *Pipe) TransactString(key *ethcrypto.KeyPair, rec string, value, gas, price *ethutil.Value, data []byte) ([]byte, error) {
+func (self *Pipe) TransactString(key *crypto.KeyPair, rec string, value, gas, price *ethutil.Value, data []byte) ([]byte, error) {
// Check if an address is stored by this address
var hash []byte
addr := self.World().Config().Get("NameReg").StorageString(rec).Bytes()
@@ -104,7 +104,7 @@ func (self *Pipe) TransactString(key *ethcrypto.KeyPair, rec string, value, gas,
return self.Transact(key, hash, value, gas, price, data)
}
-func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price *ethutil.Value, data []byte) ([]byte, error) {
+func (self *Pipe) Transact(key *crypto.KeyPair, rec []byte, value, gas, price *ethutil.Value, data []byte) ([]byte, error) {
var hash []byte
var contractCreation bool
if rec == nil {
diff --git a/ethstate/state_object.go b/ethstate/state_object.go
index d8aba9950..d28a2b80d 100644
--- a/ethstate/state_object.go
+++ b/ethstate/state_object.go
@@ -4,7 +4,7 @@ import (
"fmt"
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethtrie"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -310,7 +310,7 @@ func (c *StateObject) RlpEncode() []byte {
func (c *StateObject) CodeHash() ethutil.Bytes {
var codeHash []byte
if len(c.Code) > 0 {
- codeHash = ethcrypto.Sha3(c.Code)
+ codeHash = crypto.Sha3(c.Code)
}
return codeHash
diff --git a/ethtrie/trie.go b/ethtrie/trie.go
index 6db25db05..4a6613b9d 100644
--- a/ethtrie/trie.go
+++ b/ethtrie/trie.go
@@ -5,7 +5,7 @@ import (
"fmt"
"sync"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -64,7 +64,7 @@ func (cache *Cache) PutValue(v interface{}, force bool) interface{} {
enc := value.Encode()
if len(enc) >= 32 || force {
- sha := ethcrypto.Sha3(enc)
+ sha := crypto.Sha3(enc)
cache.nodes[string(sha)] = NewNode(sha, value, true)
cache.IsDirty = true
@@ -178,7 +178,7 @@ func (self *Trie) setRoot(root interface{}) {
switch t := root.(type) {
case string:
if t == "" {
- root = ethcrypto.Sha3([]byte(""))
+ root = crypto.Sha3([]byte(""))
}
self.Root = root
case []byte:
diff --git a/utils/cmd.go b/utils/cmd.go
index c46e1f00d..fd684640b 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -14,7 +14,7 @@ import (
"bitbucket.org/kardianos/osext"
"github.com/ethereum/go-ethereum"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethminer"
@@ -149,7 +149,7 @@ func NewClientIdentity(clientIdentifier, version, customIdentifier string) *ethw
return ethwire.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier)
}
-func NewEthereum(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager *ethcrypto.KeyManager, usePnp bool, OutboundPort string, MaxPeer int) *eth.Ethereum {
+func NewEthereum(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager *crypto.KeyManager, usePnp bool, OutboundPort string, MaxPeer int) *eth.Ethereum {
ethereum, err := eth.New(db, clientIdentity, keyManager, eth.CapDefault, usePnp)
if err != nil {
logger.Fatalln("eth start err:", err)
@@ -173,13 +173,13 @@ func ShowGenesis(ethereum *eth.Ethereum) {
exit(nil)
}
-func NewKeyManager(KeyStore string, Datadir string, db ethutil.Database) *ethcrypto.KeyManager {
- var keyManager *ethcrypto.KeyManager
+func NewKeyManager(KeyStore string, Datadir string, db ethutil.Database) *crypto.KeyManager {
+ var keyManager *crypto.KeyManager
switch {
case KeyStore == "db":
- keyManager = ethcrypto.NewDBKeyManager(db)
+ keyManager = crypto.NewDBKeyManager(db)
case KeyStore == "file":
- keyManager = ethcrypto.NewFileKeyManager(Datadir)
+ keyManager = crypto.NewFileKeyManager(Datadir)
default:
exit(fmt.Errorf("unknown keystore type: %s", KeyStore))
}
@@ -211,7 +211,7 @@ func DefaultAssetPath() string {
return assetPath
}
-func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, SecretFile string, ExportDir string, NonInteractive bool) {
+func KeyTasks(keyManager *crypto.KeyManager, KeyRing string, GenAddr bool, SecretFile string, ExportDir string, NonInteractive bool) {
var err error
switch {
diff --git a/vm/address.go b/vm/address.go
index c4aa1eb7c..235143b34 100644
--- a/vm/address.go
+++ b/vm/address.go
@@ -3,7 +3,7 @@ package vm
import (
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -27,16 +27,16 @@ var Precompiled = map[uint64]*PrecompiledAddress{
}
func sha256Func(in []byte) []byte {
- return ethcrypto.Sha256(in)
+ return crypto.Sha256(in)
}
func ripemd160Func(in []byte) []byte {
- return ethutil.RightPadBytes(ethcrypto.Ripemd160(in), 32)
+ return ethutil.RightPadBytes(crypto.Ripemd160(in), 32)
}
func ecrecoverFunc(in []byte) []byte {
// In case of an invalid sig. Defaults to return nil
defer func() { recover() }()
- return ethcrypto.Ecrecover(in)
+ return crypto.Ecrecover(in)
}
diff --git a/vm/vm.go b/vm/vm.go
index 599c8ca41..28df832d3 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -4,7 +4,7 @@ import (
"fmt"
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -391,7 +391,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case SHA3:
require(2)
size, offset := stack.Popn()
- data := ethcrypto.Sha3(mem.Get(offset.Int64(), size.Int64()))
+ data := crypto.Sha3(mem.Get(offset.Int64(), size.Int64()))
stack.Push(ethutil.BigD(data))
@@ -627,7 +627,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
)
// Generate a new address
- addr := ethcrypto.CreateAddress(closure.Address(), closure.object.Nonce)
+ addr := crypto.CreateAddress(closure.Address(), closure.object.Nonce)
closure.object.Nonce++
closure.UseGas(closure.Gas)
diff --git a/vm/vm_debug.go b/vm/vm_debug.go
index 7afc7e79a..1cf243e16 100644
--- a/vm/vm_debug.go
+++ b/vm/vm_debug.go
@@ -4,7 +4,7 @@ import (
"fmt"
"math/big"
- "github.com/ethereum/go-ethereum/ethcrypto"
+ "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
)
@@ -519,7 +519,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
// 0x20 range
case SHA3:
size, offset := stack.Popn()
- data := ethcrypto.Sha3(mem.Get(offset.Int64(), size.Int64()))
+ data := crypto.Sha3(mem.Get(offset.Int64(), size.Int64()))
stack.Push(ethutil.BigD(data))
@@ -785,7 +785,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
// Generate a new address
n := state.GetNonce(closure.Address())
- addr := ethcrypto.CreateAddress(closure.Address(), n)
+ addr := crypto.CreateAddress(closure.Address(), n)
state.SetNonce(closure.Address(), n+1)
self.Printf(" (*) %x", addr).Endl()