MCPcopy Create free account
hub / github.com/cameri/nostream / bech32PolymodStep

Function bech32PolymodStep

src/utils/transform.ts:25–33  ·  view source on GitHub ↗
(pre: number)

Source from the content-addressed store, hash-verified

23for (let i = 0; i < BECH32_ALPHABET.length; i++) { BECH32_ALPHABET_MAP[BECH32_ALPHABET[i]] = i }
24
25function bech32PolymodStep(pre: number): number {
26 const b = pre >> 25
27 return (((pre & 0x1ffffff) << 5) ^
28 (-((b >> 0) & 1) & 0x3b6a57b2) ^
29 (-((b >> 1) & 1) & 0x26508e6d) ^
30 (-((b >> 2) & 1) & 0x1ea119fa) ^
31 (-((b >> 3) & 1) & 0x3d4233dd) ^
32 (-((b >> 4) & 1) & 0x2a1462b3))
33}
34
35function bech32PrefixChk(prefix: string): number {
36 let chk = 1

Callers 3

bech32PrefixChkFunction · 0.85
bech32DecodeFunction · 0.85
bech32EncodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected