|ReleasedLast Release||Aug 2017|
Maintained by Pelle Braendgaard.
|LOCLines of Code||130|
Base encoding / decoding of any given alphabet using bitcoin style leading zero compression.
To encode a
Data object we include the
base58EncodedString() methods as an extension
import SwiftBaseX let data: Data = .... let encoded:String = data.hexEncodedString()
For cases where you need a full hex string without leading zero compression we've also included the following variation.
let encoded:String = data.fullHexEncodedString()
Hex strings are commonly prefixed with
0x in the crypto world.
0x prefixes are automatically stripped when decoding. To automatically add
0x during hex encoding pass in
true to either
String we include the
decodeBase58() methods as an extension.
import SwiftBaseX let decoded: Data = "Cn8eVZg".decodeBase58()
For cases where you need to decode a full hex string without leading zero compression we've also included the following variation.
let encoded:String = data.decodeFullHex()