This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.Try | |
// BIP173 | |
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki | |
case object Bech32 { | |
type Int5 = Byte | |
final val CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" | |
final val CHARSET_MAP: Map[Char, Int5] = CHARSET.zipWithIndex.toMap.mapValues(_.toByte) | |
final val CHARSET_REVERSE_MAP: Map[Int5, Char] = CHARSET_MAP.map(_.swap) |