[{"data":1,"prerenderedAt":406},["ShallowReactive",2],{"navigation_docs":3,"-guide":128,"-guide-surround":403},[4,40],{"title":5,"path":6,"stem":7,"children":8,"icon":39},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Encoding and Decoding","\u002Fguide\u002Fencoding","1.guide\u002F02.encoding",{"title":16,"path":17,"stem":18},"Checksums","\u002Fguide\u002Fchecksums","1.guide\u002F03.checksums",{"title":20,"path":21,"stem":22},"Identify","\u002Fguide\u002Fidentify","1.guide\u002F04.identify",{"title":24,"path":25,"stem":26},"CLI","\u002Fguide\u002Fcli","1.guide\u002F05.cli",{"title":28,"path":29,"stem":30},"Agents","\u002Fguide\u002Fagents","1.guide\u002F06.agents",{"title":32,"path":33,"stem":34},"Custom Encodings","\u002Fguide\u002Fcustom","1.guide\u002F07.custom",{"title":36,"path":37,"stem":38},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F08.playground","i-lucide-book-open",{"title":41,"path":42,"stem":43,"children":44,"icon":127},"Encodings","\u002Fencodings","2.encodings\u002F00.index",[45,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123],{"title":46,"path":42,"stem":43},"Every encoding",{"title":48,"path":49,"stem":50},"Binary","\u002Fencodings\u002Fbinary","2.encodings\u002F01.binary",{"title":52,"path":53,"stem":54},"Hex","\u002Fencodings\u002Fhex","2.encodings\u002F02.hex",{"title":56,"path":57,"stem":58},"Base32","\u002Fencodings\u002Fbase32","2.encodings\u002F03.base32",{"title":60,"path":61,"stem":62},"Base32hex","\u002Fencodings\u002Fbase32hex","2.encodings\u002F04.base32hex",{"title":64,"path":65,"stem":66},"Crockford's Base32","\u002Fencodings\u002Fbase32-crockford","2.encodings\u002F05.base32-crockford",{"title":68,"path":69,"stem":70},"z-base-32","\u002Fencodings\u002Fz-base-32","2.encodings\u002F06.z-base-32",{"title":72,"path":73,"stem":74},"Base45","\u002Fencodings\u002Fbase45","2.encodings\u002F07.base45",{"title":76,"path":77,"stem":78},"Base58","\u002Fencodings\u002Fbase58","2.encodings\u002F08.base58",{"title":80,"path":81,"stem":82},"Base58Check","\u002Fencodings\u002Fbase58check","2.encodings\u002F09.base58check",{"title":84,"path":85,"stem":86},"Base58 (Flickr)","\u002Fencodings\u002Fbase58-flickr","2.encodings\u002F10.base58-flickr",{"title":88,"path":89,"stem":90},"Base58 (Ripple)","\u002Fencodings\u002Fbase58-ripple","2.encodings\u002F11.base58-ripple",{"title":92,"path":93,"stem":94},"Base64","\u002Fencodings\u002Fbase64","2.encodings\u002F12.base64",{"title":96,"path":97,"stem":98},"Base64url","\u002Fencodings\u002Fbase64url","2.encodings\u002F13.base64url",{"title":100,"path":101,"stem":102},"Ascii85","\u002Fencodings\u002Fascii85","2.encodings\u002F14.ascii85",{"title":104,"path":105,"stem":106},"Z85","\u002Fencodings\u002Fz85","2.encodings\u002F15.z85",{"title":108,"path":109,"stem":110},"basE91","\u002Fencodings\u002Fbase91","2.encodings\u002F16.base91",{"title":112,"path":113,"stem":114},"Bech32","\u002Fencodings\u002Fbech32","2.encodings\u002F17.bech32",{"title":116,"path":117,"stem":118},"Bech32m","\u002Fencodings\u002Fbech32m","2.encodings\u002F18.bech32m",{"title":120,"path":121,"stem":122},"uuencode","\u002Fencodings\u002Fuuencode","2.encodings\u002F19.uuencode",{"title":124,"path":125,"stem":126},"Quoted-Printable","\u002Fencodings\u002Fquoted-printable","2.encodings\u002F20.quoted-printable","i-lucide-library",{"id":129,"title":10,"body":130,"description":397,"extension":398,"links":399,"meta":400,"navigation":246,"path":6,"seo":401,"stem":7,"__hash__":402},"docs\u002F1.guide\u002F01.index.md",{"type":131,"value":132,"toc":391},"minimark",[133,138,143,148,152,160,175,179,204,211,215,330,349,353,387],[134,135,137],"warning",{"title":136},"Pre-1.0","The API and the tool list can still move. Pin exact versions if you build on it now.",[139,140,142],"caution",{"title":141},"Not audited","This code has never had a security audit. Do not use it in production, with real funds or with sensitive data. It is meant for agents, puzzles and local experiments only. It comes as is, without warranty of any kind, and the authors are not liable for any loss, as the MIT license states. Anything that matters wants an audited library.",[144,145,147],"h2",{"id":146},"why-this-exists","Why this exists",[149,150,151],"p",{},"Paste a base58 string into a chat and ask what it says. The model will tell you. Confidently. It reads the shape, not the bytes, and for base58 the shape tells you nothing. Encodings are arithmetic, and a language model is bad at arithmetic it can't see.",[149,153,154,155,159],{},"So the model should call something that does the arithmetic. ",[156,157,158],"code",{},"@agntn\u002Fencodings"," is that something. Same thing in your TypeScript, your terminal and your agent.",[149,161,162,163,166,167,170,171,174],{},"Every codec here is written from its spec. RFC 4648 for base16, base32 and base64. RFC 9285 for base45. BIP173 and BIP350 for bech32. The reference code where the reference code is the spec, like basE91. No ",[156,164,165],{},"@scure\u002Fbase",", no ",[156,168,169],{},"bs58",", no codec library underneath. The one dependency is ",[156,172,173],{},"@agntn\u002Fhashes",", for the double SHA-256 behind Base58Check.",[144,176,178],{"id":177},"install","Install",[180,181,186],"pre",{"className":182,"code":183,"language":184,"meta":185,"style":185},"language-bash shiki shiki-themes encodings encodings encodings","pnpm add @agntn\u002Fencodings\n","bash","",[156,187,188],{"__ignoreMap":185},[189,190,193,197,201],"span",{"class":191,"line":192},"line",1,[189,194,196],{"class":195},"sK71F","pnpm",[189,198,200],{"class":199},"shU9J"," add",[189,202,203],{"class":199}," @agntn\u002Fencodings\n",[149,205,206,207,210],{},"Node.js 26 or newer. The library itself touches nothing from ",[156,208,209],{},"node:*",", which is why this site runs it in your browser.",[144,212,214],{"id":213},"first-calls","First calls",[180,216,220],{"className":217,"code":218,"language":219,"meta":185,"style":185},"language-ts shiki shiki-themes encodings encodings encodings","import { decode, encode, identify } from \"@agntn\u002Fencodings\";\n\nencode(\"base64\", \"hello world!\");\n\u002F\u002F \"aGVsbG8gd29ybGQh\"\n\ndecode(\"base64\", \"aGVsbG8gd29ybGQh\").bytes;\n\u002F\u002F Uint8Array(12), \"hello world!\" in UTF-8\n\nidentify(\"JBSWY3DPEBLW64TMMQ======\")[0];\n\u002F\u002F { encoding: \"base32\", confidence: 0.593, text: \"Hello World\", … }\n","ts",[156,221,222,241,248,269,276,281,299,305,310,324],{"__ignoreMap":185},[189,223,224,228,232,235,238],{"class":191,"line":192},[189,225,227],{"class":226},"skH_V","import",[189,229,231],{"class":230},"s38Sx"," { decode, encode, identify } ",[189,233,234],{"class":226},"from",[189,236,237],{"class":199}," \"@agntn\u002Fencodings\"",[189,239,240],{"class":230},";\n",[189,242,244],{"class":191,"line":243},2,[189,245,247],{"emptyLinePlaceholder":246},true,"\n",[189,249,251,254,257,260,263,266],{"class":191,"line":250},3,[189,252,253],{"class":195},"encode",[189,255,256],{"class":230},"(",[189,258,259],{"class":199},"\"base64\"",[189,261,262],{"class":230},", ",[189,264,265],{"class":199},"\"hello world!\"",[189,267,268],{"class":230},");\n",[189,270,272],{"class":191,"line":271},4,[189,273,275],{"class":274},"scIB-","\u002F\u002F \"aGVsbG8gd29ybGQh\"\n",[189,277,279],{"class":191,"line":278},5,[189,280,247],{"emptyLinePlaceholder":246},[189,282,284,287,289,291,293,296],{"class":191,"line":283},6,[189,285,286],{"class":195},"decode",[189,288,256],{"class":230},[189,290,259],{"class":199},[189,292,262],{"class":230},[189,294,295],{"class":199},"\"aGVsbG8gd29ybGQh\"",[189,297,298],{"class":230},").bytes;\n",[189,300,302],{"class":191,"line":301},7,[189,303,304],{"class":274},"\u002F\u002F Uint8Array(12), \"hello world!\" in UTF-8\n",[189,306,308],{"class":191,"line":307},8,[189,309,247],{"emptyLinePlaceholder":246},[189,311,313,316,318,321],{"class":191,"line":312},9,[189,314,315],{"class":195},"identify",[189,317,256],{"class":230},[189,319,320],{"class":199},"\"JBSWY3DPEBLW64TMMQ======\"",[189,322,323],{"class":230},")[0];\n",[189,325,327],{"class":191,"line":326},10,[189,328,329],{"class":274},"\u002F\u002F { encoding: \"base32\", confidence: 0.593, text: \"Hello World\", … }\n",[149,331,332,334,335,338,339,341,342,345,346,348],{},[156,333,253],{}," takes a string, read as UTF-8, or a ",[156,336,337],{},"Uint8Array",". ",[156,340,286],{}," always gives bytes back. Plus ",[156,343,344],{},"details"," for whatever the text carried besides data. A bech32 prefix, a witness version, a uuencode file name. Don't know the encoding? ",[156,347,315],{}," tries them all and shows its reasoning.",[144,350,352],{"id":351},"pick-your-door","Pick your door",[354,355,356,364,369,374,382],"ul",{},[357,358,359,363],"li",{},[360,361,362],"a",{"href":13},"Encoding and decoding"," for the two calls, the codec objects and the subpaths.",[357,365,366,368],{},[360,367,16],{"href":17}," for Base58Check, bech32 and segwit addresses, where a typo gets caught.",[357,370,371,373],{},[360,372,20],{"href":21}," for the mystery string somebody just sent you.",[357,375,376,378,379,381],{},[360,377,24],{"href":25}," and ",[360,380,28],{"href":29}," for the terminal and for MCP, Pi, OMP and the AI SDK.",[357,383,384,386],{},[360,385,46],{"href":42}," for the whole registry, sortable.",[388,389,390],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":185,"searchDepth":243,"depth":243,"links":392},[393,394,395,396],{"id":146,"depth":243,"text":147},{"id":177,"depth":243,"text":178},{"id":213,"depth":243,"text":214},{"id":351,"depth":243,"text":352},"Install the package and decode your first string. Every encoding answers the same two calls","md",null,{"icon":39},{"title":10,"description":397},"3LczTGdZ5Mj29jFoIhsYVkd16PtG2LiTa8FgiiA3oJE",[399,404],{"title":12,"path":13,"stem":14,"description":405,"children":-1},"Two calls by name, a codec object per encoding and a subpath per family. Strings are UTF-8 and bytes stay bytes",1790940133286]