mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-28 23:27:36 +00:00
7165b5ab1e
And drop implementation in _pkg.dev, as it's redundant. Refs. #307.
32 lines
715 B
Go
Executable file
32 lines
715 B
Go
Executable file
package crypto
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestBase58Decode(t *testing.T) {
|
|
input := "1F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX"
|
|
|
|
data, err := Base58Decode(input)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
expected := "0099bc78ba577a95a11f1a344d4d2ae55f2f857b989ea5e5e2"
|
|
actual := hex.EncodeToString(data)
|
|
assert.Equal(t, expected, actual)
|
|
}
|
|
func TestBase58Encode(t *testing.T) {
|
|
input := "0099bc78ba577a95a11f1a344d4d2ae55f2f857b989ea5e5e2"
|
|
|
|
inputBytes, _ := hex.DecodeString(input)
|
|
|
|
data := Base58Encode(inputBytes)
|
|
|
|
expected := "F1tAaz5x1HUXrCNLbtMDqcw6o5GNn4xqX" // Removed the 1 as it is not checkEncoding
|
|
actual := data
|
|
assert.Equal(t, expected, actual)
|
|
}
|