mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 11:26:24 +00:00
Use base-ex hex converter for base16 / correct fn name (#649)
This commit is contained in:
parent
c43bd21f8d
commit
054e836521
@ -1,10 +1,8 @@
|
|||||||
import { Base91 } from 'base-ex';
|
import { Base16, Base91 } from 'base-ex';
|
||||||
|
|
||||||
export default function hexToBase85(hex: string): string {
|
export default function hexToBase91(hex: string): string {
|
||||||
const hexes = hex.match(/.{1,2}/g);
|
const b16 = new Base16();
|
||||||
if (hexes == null) return '';
|
|
||||||
const byteArray = hexes.map((byte) => parseInt(byte, 16));
|
|
||||||
const b91 = new Base91();
|
const b91 = new Base91();
|
||||||
const base91string = b91.encode(new Uint8Array(byteArray));
|
const base91string = b91.encode(b16.decode(hex));
|
||||||
return base91string;
|
return base91string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user