good morning!!!!

Skip to content
Snippets Groups Projects
Commit fd9da725 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

ethcrypto => crypto

parent 3ee0461c
Branches
Tags
No related merge requests found
......@@ -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) {
......
......@@ -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
}
......
......@@ -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{}{}}
......@@ -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
......
......@@ -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 {
......
......@@ -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
......
......@@ -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()
......
package ethcrypto
package crypto
import (
"crypto/sha256"
......
package ethcrypto
package crypto
import (
"bytes"
......
package ethcrypto
package crypto
import (
"fmt"
......
package ethcrypto
package crypto
import (
"fmt"
......
package ethcrypto
package crypto
import (
"strings"
......
package ethcrypto
package crypto
import (
"fmt"
......
package ethcrypto
package crypto
import (
"github.com/ethereum/go-ethereum/ethdb"
......
package ethcrypto
package crypto
import (
"fmt"
......
package ethcrypto
package crypto
import (
"testing"
......
package ethcrypto
package crypto
var MnemonicWords []string = []string{
"like",
......
......@@ -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
}
......
......@@ -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 {
......
......@@ -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)}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment