Beispiel #1
0
func (s *Suite) TestNoMultiByte(c *gc.C) {
	c.Assert(func() { basen.NewEncoding("世界") }, gc.PanicMatches,
		"multi-byte characters not supported")
}
Beispiel #2
0
import (
	"bytes"
	"crypto/sha256"
	"encoding/binary"
	"errors"
	"github.com/cmars/basen"
	"github.com/mndrix/btcutil"
	"golang.org/x/crypto/ripemd160"
	"io"
	"math/big"
)

var (
	curve                 = btcutil.Secp256k1()
	curveParams           = curve.Params()
	BitcoinBase58Encoding = basen.NewEncoding("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
)

//
// Hashes
//

func hashSha256(data []byte) []byte {
	hasher := sha256.New()
	hasher.Write(data)
	return hasher.Sum(nil)
}

func hashDoubleSha256(data []byte) []byte {
	return hashSha256(hashSha256(data))
}