Bech32

object Bech32
class Object
trait Matchable
class Any
Bech32.type

Type members

Classlikes

case object Bech32Encoding extends Encoding
case object Bech32mEncoding extends Encoding
sealed trait Encoding

Types

type Int5 = Byte

Value members

Concrete methods

def decode(bech32: String): (String, Array[Int5], Encoding)

decodes a bech32 or bech32m string

decodes a bech32 or bech32m string

Value parameters:
bech32

bech32 or bech32m string

Returns:

a (encoding, hrp, data) tuple

Source:
Bech32.scala

decode a bitcoin witness address

decode a bitcoin witness address

Value parameters:
address

witness address

Returns:

a (prefix, version, program) tuple where prefix is the human-readable prefix, version is the witness version and program the decoded witness program. If version is 0, it will be either 20 bytes (P2WPKH) or 32 bytes (P2WSH).

Source:
Bech32.scala
def eight2five(input: Array[Byte]): Array[Int5]
Value parameters:
input

a sequence of 8 bits integers

Returns:

a sequence of 5 bits integers

Source:
Bech32.scala
def encode(hrp: String, int5s: Array[Int5], encoding: Encoding): String
Value parameters:
hrp

human readable prefix

int5s

5-bit data

Returns:

hrp + data encoded as a Bech32 string

Source:
Bech32.scala
def encodeWitnessAddress(hrp: String, witnessVersion: Byte, data: ByteVector): String

encode a bitcoin witness address

encode a bitcoin witness address

Value parameters:
data

witness program: if version is 0, either 20 bytes (P2WPKH) or 32 bytes (P2WSH)

hrp

should be "bc" or "tb"

witnessVersion

witness version (0 to 16)

Returns:

a bech32 encoded witness address

Source:
Bech32.scala
def five2eight(input: Array[Int5]): Array[Byte]
Value parameters:
input

a sequence of 5 bits integers

Returns:

a sequence of 8 bits integers

Source:
Bech32.scala

Concrete fields

val alphabet: String