Complete base58 migration to new package.
This commit is contained in:
parent
fffd6a2e87
commit
cef307c87e
3 changed files with 3 additions and 33 deletions
19
base58.go
19
base58.go
|
@ -1,19 +0,0 @@
|
||||||
// Copyright (c) 2013-2014 Conformal Systems LLC.
|
|
||||||
// Use of this source code is governed by an ISC
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package btcutil
|
|
||||||
|
|
||||||
import "github.com/conformal/btcutil/base58"
|
|
||||||
|
|
||||||
// Base58Decode wraps the new base58 package for backwards compatibility.
|
|
||||||
// TODO: Remove as soon as the other repos have been updated to use the new package.
|
|
||||||
func Base58Decode(b string) []byte {
|
|
||||||
return base58.Decode(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Base58Encode wraps the new base58 package for backwards compatibility.
|
|
||||||
// TODO: Remove as soon as the other repos have been updated to use the new package.
|
|
||||||
func Base58Encode(b []byte) string {
|
|
||||||
return base58.Encode(b)
|
|
||||||
}
|
|
|
@ -63,7 +63,7 @@ var hexTests = []struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBase58(t *testing.T) {
|
func TestBase58(t *testing.T) {
|
||||||
// Base58Encode tests
|
// Encode tests
|
||||||
for x, test := range stringTests {
|
for x, test := range stringTests {
|
||||||
tmp := []byte(test.in)
|
tmp := []byte(test.in)
|
||||||
if res := base58.Encode(tmp); res != test.out {
|
if res := base58.Encode(tmp); res != test.out {
|
||||||
|
@ -73,7 +73,7 @@ func TestBase58(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base58Decode tests
|
// Decode tests
|
||||||
for x, test := range hexTests {
|
for x, test := range hexTests {
|
||||||
b, err := hex.DecodeString(test.in)
|
b, err := hex.DecodeString(test.in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -87,7 +87,7 @@ func TestBase58(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base58Decode with invalid input
|
// Decode with invalid input
|
||||||
for x, test := range invalidStringTests {
|
for x, test := range invalidStringTests {
|
||||||
if res := base58.Decode(test.in); string(res) != test.out {
|
if res := base58.Decode(test.in); string(res) != test.out {
|
||||||
t.Errorf("Decode invalidString test #%d failed: got: %q want: %q",
|
t.Errorf("Decode invalidString test #%d failed: got: %q want: %q",
|
||||||
|
|
11
doc.go
11
doc.go
|
@ -18,16 +18,5 @@ A Tx defines a bitcoin transaction that provides more efficient manipulation of
|
||||||
raw wire protocol transactions. It memoizes the hash for the transaction on its
|
raw wire protocol transactions. It memoizes the hash for the transaction on its
|
||||||
first access so subsequent accesses don't have to repeat the relatively
|
first access so subsequent accesses don't have to repeat the relatively
|
||||||
expensive hashing operations.
|
expensive hashing operations.
|
||||||
|
|
||||||
Base58 Usage
|
|
||||||
|
|
||||||
To decode a base58 string:
|
|
||||||
|
|
||||||
rawData := btcutil.Base58Decode(encodedData)
|
|
||||||
|
|
||||||
Similarly, to encode the same data:
|
|
||||||
|
|
||||||
encodedData := btcutil.Base58Encode(rawData)
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package btcutil
|
package btcutil
|
||||||
|
|
Loading…
Reference in a new issue