OSDN Git Service

Remove unused code (#548)
[bytom/bytom.git] / crypto / crypto.go
index 46c4600..cd33037 100644 (file)
 package crypto
 
 import (
-       "fmt"
-       //"io"
-       //"io/ioutil"
-       //"math/big"
-       //"os"
-
-       //"encoding/hex"
-       //"errors"
-
        "github.com/bytom/common"
        "golang.org/x/crypto/ripemd160"
        "golang.org/x/crypto/sha3"
@@ -57,36 +48,3 @@ func Ripemd160(data []byte) []byte {
 
        return ripemd.Sum(nil)
 }
-
-func PubkeyToAddress(pubBytes []byte) common.Address {
-       address, _ := common.AddressEncode("bm", 1, toInt(Ripemd160(Sha3(pubBytes))))
-       fmt.Printf(address)
-       return common.StringToAddress(address)
-}
-
-func AddressToPubkey(addr common.Address) (int, []byte, error) {
-       ver, data, err := common.AddressDecode("bm", addr.Str())
-       return ver, toBytes(data), err
-}
-
-func zeroBytes(bytes []byte) {
-       for i := range bytes {
-               bytes[i] = 0
-       }
-}
-
-func toInt(bytes []byte) []int {
-       ints := make([]int, len(bytes))
-       for i := range bytes {
-               ints[i] = int(bytes[i])
-       }
-       return ints
-}
-
-func toBytes(ints []int) []byte {
-       bytes := make([]byte, len(ints))
-       for i := range ints {
-               bytes[i] = byte(ints[i])
-       }
-       return bytes
-}