diff --git a/frontend/src/utils/hexToBase91.ts b/frontend/src/utils/hexToBase91.ts index 73955d3a..3eb5ccf0 100644 --- a/frontend/src/utils/hexToBase91.ts +++ b/frontend/src/utils/hexToBase91.ts @@ -1,10 +1,8 @@ -import { Base91 } from 'base-ex'; +import { Base16, Base91 } from 'base-ex'; -export default function hexToBase85(hex: string): string { - const hexes = hex.match(/.{1,2}/g); - if (hexes == null) return ''; - const byteArray = hexes.map((byte) => parseInt(byte, 16)); +export default function hexToBase91(hex: string): string { + const b16 = new Base16(); const b91 = new Base91(); - const base91string = b91.encode(new Uint8Array(byteArray)); + const base91string = b91.encode(b16.decode(hex)); return base91string; }