(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Wolfram 15.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       154,          7]
NotebookDataLength[     49681,       1299]
NotebookOptionsPosition[     39729,       1116]
NotebookOutlinePosition[     42004,       1168]
CellTagsIndexPosition[     41926,       1163]
WindowTitle->Bech32Encode
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[GridBox[{
   {GridBox[{
      {
       ItemBox[Cell[BoxData[
         RowBox[{
          TemplateBox[{12},
           "Spacer1"], Cell[
          "WOLFRAM INSTITUTE/ PUZZLES SYMBOL", "PacletNameCell",
           TextAlignment->Center,ExpressionUUID->
           "4f567866-23a4-4d9b-9cce-906566fd4e79"], 
          TemplateBox[{8},
           "Spacer1"]}]],
         TextAlignment->Center,ExpressionUUID->
         "f042a894-551d-4bf5-a6d6-36f6482d2bfc"],
        Background->LightDarkSwitched[
          RGBColor[0.490196, 0.576471, 0.690196]],
        ItemSize->Full], ""}
     },
     GridBoxAlignment->{"Rows" -> {{Center}}},
     GridBoxItemSize->{"Columns" -> {Full, 
         Scaled[0.02]}, "Rows" -> {{2.5}}}], Cell[TextData[{
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "See Also",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "a8bb700b-61eb-40da-aee0-c77fcf4789ba"]
         }],ExpressionUUID->"947d5f35-19ba-4d86-a9f9-e6bfe016161c"],
         StripOnInput->False],{
        StyleBox["\"Bech32Decode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Bech32Decode"], 
         StyleBox["\"Bech32Q\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Bech32Q"], 
         StyleBox[
          "\"SegWitAddressEncode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode"], 
         StyleBox["\"BitRegroup\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/BitRegroup"], 
         StyleBox[
          "\"Base58CheckEncode\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/Base58CheckEncode"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"SeeAlso"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "5c64dcb9-42ea-407e-9a06-bfbb3563dc56"],
     "\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\
\[ThickSpace]",
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "Related Guides",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "77f7d21e-237c-47db-a975-5ae554976737"]
         }],ExpressionUUID->"50067a14-bb1f-496d-90eb-309b56105583"],
         StripOnInput->False],{
        "\"Encodings\"" :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/guide/Encodings"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"MoreAbout"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "92523f96-ed4a-486d-a744-5ce46dc34d04"],
     "\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\[ThickSpace]\
\[ThickSpace]",
     Cell[BoxData[
      TagBox[
       ActionMenuBox[
        FrameBox[Cell[TextData[{
          "URL",
          " ",
          Cell[BoxData[
           GraphicsBox[
            {GrayLevel[0.66667], Thickness[0.13], 
             LineBox[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]},
            AspectRatio->1,
            ImageSize->20,
            PlotRange->{{-3, 4}, {-1, 1}}]],ExpressionUUID->
           "532b3469-185c-46d1-a140-71b38119b515"]
         }],ExpressionUUID->"376c288a-4f67-46af-88f0-d414b5f584b5"],
         StripOnInput->False],{
        "\"WolframInstitute/Puzzles/ref/Bech32Encode\"" :> None, 
         "\"Copy Wolfram Documentation Center URL\"" :> 
         CopyToClipboard["WolframInstitute/Puzzles/ref/Bech32Encode"], 
         Delimiter, "\"Copy web URL\"" :> 
         Module[{DocumentationSearch`Private`nb$}, 
           DocumentationSearch`Private`nb$ = 
            NotebookPut[
             Notebook[{
               Cell[BoxData[
                 MakeBoxes[
                  Hyperlink[
                   "http://reference.wolfram.com/language/WolframInstitute/\
Puzzles/ref/Bech32Encode.html"], StandardForm]], "Input", TextClipboardType -> 
                 "PlainText"]}, Visible -> False]]; 
           SelectionMove[DocumentationSearch`Private`nb$, All, Notebook]; 
           FrontEndTokenExecute[DocumentationSearch`Private`nb$, "Copy"]; 
           NotebookClose[DocumentationSearch`Private`nb$]; Null], 
         "\"Go to web URL\"" :> 
         FrontEndExecute[{
           NotebookLocate[{
             URL[If[TrueQ[False], 
                 "http://reference.wolfram.com/system-modeler/", 
                 "http://reference.wolfram.com/language/"] <> 
               "WolframInstitute/Puzzles/ref/Bech32Encode" <> ".html"], 
              None}]}]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"URLMenu"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "d75fbbe3-f6e2-4b1c-a6b5-8ed612ac316f"]
    }], "AnchorBar",
     CacheGraphics->False,ExpressionUUID->
     "666cb56f-7e88-404d-91fc-dc0244d66f86"]}
  }]], "AnchorBarGrid",
 CellID->1,ExpressionUUID->"68dee2b3-b934-4f91-b975-9b90612acc90"],

Cell["WolframInstitute`Puzzles`", "ContextNameCell",ExpressionUUID->"f2529dce-5732-4cf7-96e7-a39156e258a4"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {Cell[TextData[{
     Cell[
     "Bech32Encode", "ObjectName",ExpressionUUID->
      "84482146-aeeb-4672-9131-05986247e72b"],
     Cell[BoxData[
      TemplateBox[{8},
       "Spacer1"]],ExpressionUUID->"f3404f5f-24b4-4059-8008-18146834b1ac"],
     Cell[BoxData[
     ""], "ObjectNameTranslation",ExpressionUUID->
      "caa04912-12f9-48d2-b5ab-af21c7c8fee6"]
    }],ExpressionUUID->"945d4c33-9f99-4465-9b0e-3620e0d94d3d"], 
    "\[SpanFromLeft]"}
  }]], "ObjectNameGrid",ExpressionUUID->"5879d6f9-734e-46f2-a0ba-\
9f4123310aec"],

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["Bech32Encode"]], 
         "paclet:WolframInstitute/Puzzles/ref/Bech32Encode", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["hrp", "TI"], ",", " ", 
        StyleBox["data", "TI"]}], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "ac2e2f39-47ef-4df4-ac34-ed5ee3aaa79e"],
     "\[LineSeparator]",
     "gives the Bech32 string with human-readable part ",
     StyleBox["hrp", "TI"],
     " and a ",
     StyleBox["data", "TI"],
     " part of 5-bit values, appending the six-character checksum."
    }],ExpressionUUID->"4dc9332b-f0d3-499a-9f0d-f43416d68e83"]},
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["Bech32Encode"]], 
         "paclet:WolframInstitute/Puzzles/ref/Bech32Encode", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["hrp", "TI"], ",", " ", 
        StyleBox["data", "TI"], ",", " ", "\"\<Bech32m\>\""}], "]"}]], 
      "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "030e2edd-ae89-4457-9a64-cd7539c72b95"],
     "\[LineSeparator]",
     "uses the BIP350 Bech32m checksum constant instead."
    }],ExpressionUUID->"de2827ae-b52b-439f-b4c4-c1cb546ca0e2"]}
  }]], "Usage",ExpressionUUID->"1cc2efe5-a14c-48b7-ad24-a2d9c1e65ce8"]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[Cell[BoxData[Cell[TextData[{
  Cell[BoxData[
   DynamicBox[ToBoxes[
     If[CurrentValue[
        EvaluationCell[], "CellGroupOpen"] =!= Closed, 
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], 
      Rotate[
       Style[
        Graphics[{
          Thickness[0.18], 
          RGBColor[0.8509803921568627, 0.396078431372549, 0], 
          Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
         PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
        0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]],
    ImageSizeCache->{
     13.600000000000001`, {-0.1685058593749993, 13.768505859375}}]],
   ExpressionUUID->"25b976bc-b631-4928-b0f8-596fa59827ca"],
  Cell[BoxData[
   TemplateBox[{1},
    "Spacer1"]],ExpressionUUID->"0e228edc-8edc-4c4a-9f37-c308a8a36e48"],
  "Details and Options"
 }], "NotesFrameText",ExpressionUUID->
  "406ce686-ee74-4604-a8e2-63c4ca054642"]],ExpressionUUID->"e3f9ebfd-46a3-\
4e19-a8b0-cdedc0562523"]], "NotesSection",
 ShowGroupOpener->"Thumbnail",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CacheGraphics->False,
 CellID->380397612,ExpressionUUID->"b2d6b45a-17fb-4c42-a22d-b338a988f57e"],

Cell[TextData[{
 "The output is ",
 StyleBox["hrp", "TI"],
 ", then the separator ",
 Cell[BoxData["\<\"1\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "e673c772-de96-4606-bf4d-9bdec6da0eef"],
 ", then one character per data value from the alphabet ",
 Cell[BoxData["\<\"qpzry9x8gf2tvdw0s3jn54khce6mua7l\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "9e39f5f6-3924-4070-b7dc-4e4bdcf74136"],
 ", then six checksum characters."
}], "Notes",ExpressionUUID->"33a66d4c-5537-4e40-9f90-608a3f1aaece"],

Cell[TextData[{
 "The human-readable part must be 1 to 83 characters with codes between 33 \
and 126 and no upper-case letters. Encoders emit lower case, so an upper-case \
",
 StyleBox["hrp", "TI"],
 " matches no definition and the call is returned unevaluated."
}], "Notes",ExpressionUUID->"a153cb21-a924-4535-a206-2d3989dbe980"],

Cell["Each data value must be an integer between 0 and 31.", "Notes",ExpressionUUID->"8d529e51-0924-4a2b-adf7-e31a6104adee"],

Cell[TextData[{
 "The two variants differ only in the constant xored into the BCH checksum: 1 \
for Bech32, ",
 Cell[BoxData[
  RowBox[{"0", "x2bc830a3"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "c149477d-1273-48ff-9d4a-9e23d18af482"],
 " for Bech32m. BIP350 notes that no string is valid under both."
}], "Notes",ExpressionUUID->"9bfecd9e-8821-4d68-8971-e431bf4055fb"],

Cell[TextData[{
 "With the default ",
 Cell[BoxData[
  RowBox[{"\<\"MaximumLength\"\>", " ", "->", " ", "90"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "adf50cec-37e1-4a9d-a537-05d8a3851eae"],
 ", the BIP173 limit, a longer result gives a ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Failure"]], "paclet:ref/Failure"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "9e0872c0-faa6-4fac-b6a2-a0052ad76e5f"],
 ". Lightning BOLT11 invoices are Bech32 strings with no length limit, so set \
the option to ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Infinity"]], "paclet:ref/Infinity"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "678088b8-f803-4aaf-9b9d-9f74c1219b67"],
 " for those."
}], "Notes",ExpressionUUID->"764c3cf5-d3bd-474c-8dbe-36e74091cb87"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["SegWitAddressEncode"]], 
    "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "c77d5799-c657-4166-9abd-4181ae15bb3c"],
 " is the segregated witness address layer above this, and it chooses the \
variant from the witness version."
}], "Notes",ExpressionUUID->"be921984-b20f-48d5-81c7-fca70b5623a5"],

Cell[BoxData[GridBox[{
   {Cell["      ", "TableRowIcon",ExpressionUUID->
     "75f2bf7c-ff21-4bb0-b729-a3765b326f08"], Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"b2b02123-6fa1-4a3c-96cc-6582e837ce24"],
     Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"303df7f1-bd9c-4c8e-ab2d-60593edd4218"],
     Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"4c26234f-4298-4edf-9003-045bf6ba91ed"]},
   {Cell["      ", "TableRowIcon",ExpressionUUID->
     "c195de34-21f6-4f30-9bec-71bb5ad07574"], Cell[TextData[Cell[
    BoxData["\"\<MaximumLength\>\""], "InlineFormula",
     FontFamily->"Source Sans Pro",
     FontSize->0.9 Inherited,ExpressionUUID->
     "5c9dbd73-a072-4796-88d8-74c1012a7f67"]], "TableText",ExpressionUUID->
     "9efd0b4a-51ea-49ca-a797-866b648c1cb0"], Cell[TextData[Cell[BoxData[
    "90"], "InlineFormula",
     FontFamily->"Source Sans Pro",
     FontSize->0.9 Inherited,ExpressionUUID->
     "5724b95f-f527-4ae2-a12b-0ccbd4845583"]], "TableText",ExpressionUUID->
     "2e5c7263-6994-4a93-b07d-9b9501e9de9a"], Cell[TextData[{
     "longest permitted result; the BIP173 limit, liftable to ",
     Cell[BoxData[
      TemplateBox[{
        Cell[
         TextData["Infinity"]], "paclet:ref/Infinity"},
       "RefLink",
       BaseStyle->"InlineFormula"]], "InlineFormula",
      FontFamily->"Source Sans Pro",ExpressionUUID->
      "3d57f4b6-fb5a-4d4d-b339-f894c718fc6e"],
     " for BOLT11"
    }], "TableText",ExpressionUUID->"7293d755-84aa-4f10-adf8-973ab1060d53"]}
  }]], "3ColumnTableMod",
 GridBoxOptions->{
 GridBoxBackground->{"Columns" -> {{None}}, "Rows" -> {None, {None}}},
 GridBoxDividers->{
  "Rows" -> {{
     True, True, 
      True}}}},ExpressionUUID->"ec750a1c-aec8-4724-a4f2-28526c597e0e"]
}, Closed]],

Cell["", "PageDelimiter",ExpressionUUID->"65f54ab2-34c2-4c5a-ae5b-22177a914d83"],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[
     MatchQ[
      CurrentValue[
       EvaluationNotebook[], {
       TaggingRules, "Openers", "PrimaryExamplesSection"}, Open], 
      Alternatives[True, Open]], 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]],
   ImageSizeCache->{
    13.600000000000001`, {4.251494140625001, 9.348505859375}}]],
  ExpressionUUID->"2227547e-c817-4d52-ab38-8763a67f1bf5"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"33004840-5e3a-48a7-b0fc-3a15de12a7ea"],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(12)", "ExampleCount",ExpressionUUID->
  "b24f360e-453d-4e4f-b142-37832b3e9288"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->283847765,ExpressionUUID->"c8d51a2f-be1a-414a-9fd5-56625cf8942e"],

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<WolframInstitute`Puzzles`\>\"", "]"}]], "Input", \
"ExampleInitialization",
 CellLabel->"In[1]:=",
 CellID->1969679695,ExpressionUUID->"ab3cf2f6-3501-4be1-bdad-6eb1f85f4cc5"],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "210fe983-ba90-44fc-8fe0-982d3e051929"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"2699be1d-e5fd-4da3-9e16-a4437964b54f"],
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "dbe73b3c-5309-4f8c-93c7-0e940cd7fb89"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1068206368,ExpressionUUID->"539929a5-02b1-4a09-ad04-e327f6041419"],

Cell[TextData[{
 "The BIP173 test vector with human-readable part ",
 Cell[BoxData["\<\"a\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "5fec88c7-ff8c-4f71-a9a9-f4ff3cc388fb"],
 " and an empty data part:"
}], "ExampleText",
 CellTags->
  "TextAnnotation",ExpressionUUID->"f3e32436-8bb5-47a4-8dfb-22914da696c3"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<a\>\"", ",", " ", 
   RowBox[{"{", "}"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"f531caba-c9c7-408b-a0b6-0608bdb734a1"],

Cell[BoxData["\<\"a12uel5l\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"8d80ab6d-5516-4c53-beb0-b7f565ad8a63"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "e2be71ae-315d-4cd4-8b2e-e80c87b90317"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"572ad977-e107-4ab9-\
8009-6672ef91c9b2"],

Cell["\<\
The same payload under the BIP350 Bech32m checksum constant gives a different \
string:\
\>", "ExampleText",ExpressionUUID->"e3cfaf19-40a7-41a9-b073-5651ae1c17cf"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<a\>\"", ",", " ", 
   RowBox[{"{", "}"}], ",", " ", "\"\<Bech32m\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"50f4eb57-9e88-49b3-b5f9-2c798412a4f5"],

Cell[BoxData["\<\"a1lqfn3a\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"01565ac5-dc61-4cda-8e2f-143de930220f"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "396b5347-8249-4a15-9d37-7a2484be450a"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"ef7aa503-d749-4a67-\
87b7-6ab75a6c670d"],

Cell["\<\
The BIP173 vector whose data part is every 5-bit value in order:\
\>", "ExampleText",ExpressionUUID->"ed6d223c-8068-4c57-b1f5-634a28180df5"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<abcdef\>\"", ",", " ", 
   RowBox[{"Range", "[", 
    RowBox[{"0", ",", " ", "31"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"adfdff70-f536-44d8-a56e-ac702d076f3b"],

Cell[BoxData["\<\"abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw\"\>"], \
"Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"f6a0947f-ae63-4521-84a6-a15a8f9d68f8"]
}, Open  ]]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "5ca75c0d-82ed-4c4b-9a16-ca0625cd8ce5"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"f49e1113-fe12-4d0e-aa63-2032d248abb1"],
 "Scope",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "798a7759-e6d4-4652-8e0d-5b6d9a6fc735"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1293636265,ExpressionUUID->"1e73c5ed-3bf2-4eb8-8908-00f8b0e0bab5"],

Cell["\<\
An 83-character human-readable part with an empty data part is exactly 90 \
characters, the BIP173 maximum:\
\>", "ExampleText",ExpressionUUID->"a3601de2-b22f-4141-910a-3e2955e367cc"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"StringLength", "[", 
  RowBox[{"Bech32Encode", "[", 
   RowBox[{"\"\<\
an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharacte\
rsbio\>\"", ",", " ", 
    RowBox[{"{", "}"}]}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"45f8fc0a-1334-4226-b480-453543094f68"],

Cell[BoxData["90"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"e79106c1-2161-4400-8741-daad3a4d5943"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "46bed107-460e-4000-a863-e75f94b5e1b5"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"c95c7085-a3ae-4c37-\
ba42-bc61132f4673"],

Cell["\<\
The Bech32m form of the same human-readable part is a BIP350 test vector:\
\>", "ExampleText",ExpressionUUID->"2a31a4d8-276d-4044-a589-897e3c82de25"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<\
an83characterlonghumanreadablepartthatcontainsthetheexcludedcharactersbioandnu\
mber1\>\"", ",", " ", 
   RowBox[{"{", "}"}], ",", " ", "\"\<Bech32m\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"61642e56-212f-4508-907a-6455d2bdedf5"],

Cell[BoxData["\<\"\
an83characterlonghumanreadablepartthatcontainsthetheexcludedcharactersbioandnu\
mber11sg7hg6\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"c60ab2ff-25f4-4f27-a524-fca52e9a5143"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "f71a0ecb-a298-42b1-bfea-2a4d83ffb1bf"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"a0b12ac3-284e-4679-\
b9a7-eb52081795f4"],

Cell["\<\
A witness program regrouped to 5-bit values, with the witness version in \
front, is what a segregated witness address encodes:\
\>", "ExampleText",ExpressionUUID->"2a8a3e22-359b-48d4-a1b0-78911081c72e"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", 
   RowBox[{"Prepend", "[", 
    RowBox[{
     RowBox[{"BitRegroup", "[", 
      RowBox[{
       RowBox[{
       "HexStringToByteList", 
        "[", "\"\<751e76e8199196d454941c45d1b3a323f1433bd6\>\"", "]"}], ",", 
       " ", "8", ",", " ", "5"}], "]"}], ",", " ", "0"}], "]"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"be7b8620-5a0f-4124-b54c-5adc17a3ebd4"],

Cell[BoxData["\<\"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4\"\>"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"d6c55903-6856-4830-865b-56f16776e13b"]
}, Open  ]]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "67904279-44ea-4db5-8187-1b05c8789526"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"f977fd7a-2008-4fc0-868d-cae64de89ff6"],
 "Options",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "fd8859f6-0769-456a-9039-0df176a632f4"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->2061341341,ExpressionUUID->"1a989461-bf31-4510-84c4-cb845e752052"],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "350bd72a-cd1b-4d13-9296-8c9f8e3eab10"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"27a832b3-9056-4f07-88d6-ef0f419f41bc"],
 "MaximumLength",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(1)", "ExampleCount",ExpressionUUID->
  "ab0afd5b-8e94-4660-a0fe-1082fbf6a0c3"]
}], "ExampleSubsection", "ExampleSubsection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,ExpressionUUID->"33948204-384f-490b-a94d-a26316897831"],

Cell[TextData[{
 "One data value past the 90-character maximum gives a ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Failure"]], "paclet:ref/Failure"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "d6604c03-e18c-4507-9fa5-dcbc39f3e830"],
 " under the default:"
}], "ExampleText",ExpressionUUID->"b7ecfd0c-5572-4304-9ced-91f6abe6fbe6"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"FailureQ", "[", 
  RowBox[{"Bech32Encode", "[", 
   RowBox[{"\"\<\
an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharacte\
rsbio\>\"", ",", " ", 
    RowBox[{"{", "0", "}"}]}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"b30c8c70-13ce-41e1-8838-7439230ac89a"],

Cell[BoxData["True"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"038c6892-6429-47de-bd1a-64dc2df369df"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "805b7246-ca60-48c8-a781-c48d231a7fab"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"738abe58-3db2-4c1c-\
a4fe-1f0fdcb0726f"],

Cell["\<\
Lifting the limit encodes it, which is what a Lightning BOLT11 invoice needs:\
\
\>", "ExampleText",ExpressionUUID->"c3e29b20-8c8d-410d-93a9-937ca98e8bdc"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"StringLength", "[", 
  RowBox[{"Bech32Encode", "[", 
   RowBox[{"\"\<\
an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharacte\
rsbio\>\"", ",", " ", 
    RowBox[{"{", "0", "}"}], ",", " ", 
    RowBox[{"\"\<MaximumLength\>\"", " ", "->", " ", "Infinity"}]}], "]"}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"4bea368f-b417-4bbc-bdfd-6bef0c9b56ae"],

Cell[BoxData["91"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"3b7ab9f9-4e39-45b7-b833-5a0fb989d35d"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "c0a9b22c-7ec0-4504-a10d-b4f163a94a78"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"8570bca4-7273-454f-ae73-c76445dfc5d4"],
 "Properties & Relations",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "667d71ec-1a1f-42c7-bf99-0fd6e0bcccf1"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->2123667759,ExpressionUUID->"ceb0c6fd-a9db-4f0a-a093-f6d2da3b4578"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["Bech32Decode"]], 
    "paclet:WolframInstitute/Puzzles/ref/Bech32Decode", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "7d46eb81-c274-4782-85b5-0ebed90c22b1"],
 " recovers the human-readable part, the data and the variant:"
}], "ExampleText",ExpressionUUID->"1eb4817c-f110-4319-9fc1-29125192015f"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Normal", "[", 
  RowBox[{"Bech32Decode", "[", 
   RowBox[{"Bech32Encode", "[", 
    RowBox[{"\"\<bc\>\"", ",", " ", 
     RowBox[{"{", 
      RowBox[{"0", ",", " ", "1", ",", " ", "2"}], "}"}], ",", 
     " ", "\"\<Bech32m\>\""}], "]"}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"321d83e5-4e9a-4806-9a86-26eeeadb53d2"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"\<\"HumanReadablePart\"\>", "\[Rule]", "\<\"bc\"\>"}], ",", 
   RowBox[{"\<\"Data\"\>", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{"0", ",", "1", ",", "2"}], "}"}]}], ",", 
   RowBox[{"\<\"Variant\"\>", "\[Rule]", "\<\"Bech32m\"\>"}]}], 
  "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"13c438ae-f6ba-4185-9bd1-4bf5b0b40775"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "4528c2bb-8633-4879-9211-5cd71038deb9"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"fa88979c-5315-4125-\
98a2-61379c3d7b60"],

Cell["\<\
No string is valid under both variants, so the Bech32 encoding of a payload \
fails a Bech32m test:\
\>", "ExampleText",ExpressionUUID->"3bc545b3-f787-4d14-baf4-7765afe00f68"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Q", "[", 
  RowBox[{
   RowBox[{"Bech32Encode", "[", 
    RowBox[{"\"\<bc\>\"", ",", " ", 
     RowBox[{"{", 
      RowBox[{"0", ",", " ", "1", ",", " ", "2"}], "}"}]}], "]"}], ",", 
   " ", "\"\<Bech32m\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"9c578f27-5636-44a1-98e1-57416a574357"],

Cell[BoxData["False"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"60df6de0-15bd-4fe0-9d11-a981a558fef8"]
}, Open  ]]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
 Cell[BoxData[
  DynamicBox[ToBoxes[
    If[CurrentValue[
       EvaluationCell[], "CellGroupOpen"] =!= Closed, 
     Style[
      Graphics[{
        Thickness[0.18], 
        RGBColor[0.8509803921568627, 0.396078431372549, 0], 
        Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
       PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
      0.68 Inherited], 
     Rotate[
      Style[
       Graphics[{
         Thickness[0.18], 
         RGBColor[0.8509803921568627, 0.396078431372549, 0], 
         Line[{{-1.8, 0.5}, {0, 0}, {1.8, 0.5}}]}, AspectRatio -> 1, 
        PlotRange -> {{-3, 4}, {-1, 1}}, ImageSize -> 20], Magnification -> 
       0.68 Inherited], Rational[1, 2] Pi, {-1.65, -1}]]]]],ExpressionUUID->
  "097c4302-6fcb-4ff9-a25c-eac9c8064629"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"6f99e67d-ae44-42cb-b7b9-289c79aaae85"],
 "Possible Issues",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "c6fc1687-0f9d-4b7c-a7d9-915d0a532da3"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1305812373,ExpressionUUID->"ec7bd910-f78a-4bda-855f-b92f0f0dc2e3"],

Cell["\<\
An upper-case human-readable part is not something an encoder may emit, so \
the call is returned unevaluated:\
\>", "ExampleText",ExpressionUUID->"c97234e6-9ae1-4e44-8c20-384bd1d42a8e"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<BC\>\"", ",", " ", 
   RowBox[{"{", "0", "}"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"aebf3cf1-e2c5-4ae4-a835-1d7fdec184c7"],

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\<\"BC\"\>", ",", 
   RowBox[{"{", "0", "}"}]}], "]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"3dfd5a14-d8da-4ceb-96a0-0b4f95cb15a1"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "ff5a53ab-2d9d-4d17-bc6f-d1931dfde67f"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"01b5ff99-3ecd-436c-\
be5b-e1f73fe1f2c9"],

Cell["\<\
32 is not a 5-bit value, so the call is returned unevaluated:\
\>", "ExampleText",ExpressionUUID->"9bdf9570-f04a-40a4-9fd6-2b905bab8eaa"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\"\<bc\>\"", ",", " ", 
   RowBox[{"{", "32", "}"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"f4f22243-5ba1-4863-a64d-5526334dbb20"],

Cell[BoxData[
 RowBox[{"Bech32Encode", "[", 
  RowBox[{"\<\"bc\"\>", ",", 
   RowBox[{"{", "32", "}"}]}], "]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"0bbb76b0-f484-4358-9d5e-4ab5ce1240a8"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, 
       "RelatedFunction.png"]]], GridBox[{
      {
       StyleBox[
        RowBox[{"See", " ", "Also"}], "SeeAlsoSection"]},
      {Cell[TextData[{
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Bech32Decode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Bech32Decode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "7235e2da-21d9-4966-a859-33d2088581a2"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Bech32Q"]], 
           "paclet:WolframInstitute/Puzzles/ref/Bech32Q", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "ea8d1c0f-6952-4d05-85a6-4760674f8f69"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["SegWitAddressEncode"]], 
           "paclet:WolframInstitute/Puzzles/ref/SegWitAddressEncode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "43890b2e-48a0-4169-9b89-22d3a2381fdf"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["BitRegroup"]], 
           "paclet:WolframInstitute/Puzzles/ref/BitRegroup", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "f0158475-f1c0-4fb4-a6f7-ccd6a7fda6ec"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Base58CheckEncode"]], 
           "paclet:WolframInstitute/Puzzles/ref/Base58CheckEncode", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "bba009ac-c7cf-47d7-b8af-278221cdd103"]
       }], "SeeAlso",ExpressionUUID->"7c122832-1465-4c2f-adb5-07dd4d1d6456"]}
     }]}
  }]], "SeeAlsoSection",ExpressionUUID->"767332ed-3de4-476f-b327-\
d8d8f3e00b9d"],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, 
       "RelatedGuide.png"]]], GridBox[{
      {
       StyleBox[
        RowBox[{"Related", " ", "Guides"}], "MoreAboutSection"]},
      {
       RowBox[{"\[FilledVerySmallSquare]", Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Encodings"]], 
           "paclet:WolframInstitute/Puzzles/guide/Encodings"},
          "RefLinkPlain",
          BaseStyle->{"MoreAbout"}]], "MoreAbout",ExpressionUUID->
         "e3f3399f-4684-452c-a7fe-13c4bf973c79"]}]}
     }]}
  }]], "MoreAboutSection",ExpressionUUID->"c5e34f80-55a7-4f00-b812-\
5020e4cac07a"],

Cell[" ", "FooterCell",ExpressionUUID->"96552515-aecf-437e-896e-a5760bc85d84"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{900, 830},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
WindowTitle->"Bech32Encode",
TaggingRules->{
 "ModificationHighlight" -> False, "ColorType" -> "", "LinkTrails" -> "", 
  "ExampleCounter" -> 1, 
  "Openers" -> {
   "PrimaryExamplesSection" -> Open, "ExampleSection" -> {"0" -> Open}, 
    "AllOptsTable" -> Closed}, "NewStyles" -> True, 
  "CitationPopupData" -> $Failed, "ShowCitation" -> False, "HasOptions" -> 
  True, "RootCaptions" -> "", "HeaderCoreAreaLink" -> {}, 
  "Metadata" -> {
   "built" -> "{2026, 8, 27, 0, 11, 18.310947}", 
    "history" -> {"XX", "", "", ""}, "context" -> "WolframInstitute`Puzzles`",
     "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Wolfram Institute/ Puzzles Symbol", "language" -> "en", "paclet" -> 
    "WolframInstitute/Puzzles", "status" -> "None", "summary" -> 
    "PackageLink[Bech32Encode,paclet : \
WolframInstitute/Puzzles/ref/Bech32Encode, WolframInstitute/Puzzles Package \
Symbol][hrp, data] gives the Bech32 string with human-readable part hrp and a \
data part of 5-bit values, appending the six-character checksum. \
PackageLink[Bech32Encode,paclet : WolframInstitute/Puzzles/ref/Bech32Encode, \
WolframInstitute/Puzzles Package Symbol][hrp, data, Bech32m] uses the BIP350 \
Bech32m checksum constant instead.", "synonyms" -> {}, "tabletags" -> {}, 
    "title" -> "Bech32Encode", "titlemodifier" -> "", "metadescription" -> "",
     "windowtitle" -> "Bech32Encode", "type" -> "Symbol", "uri" -> 
    "WolframInstitute/Puzzles/ref/Bech32Encode", "WorkflowDockedCell" -> ""}, 
  "SearchTextTranslated" -> ""},
CellContext->CellGroup,
FrontEndVersion->"15.0 for Mac OS X ARM (64-bit) (May 19, 2026)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Reference.nb"],
ExpressionUUID->"f6c56715-6a60-4a7b-a564-9bed590cc546"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{
 "TextAnnotation"->{
  Cell[18032, 474, 366, 9, 70, "ExampleText",ExpressionUUID->"f3e32436-8bb5-47a4-8dfb-22914da696c3",
   CellTags->"TextAnnotation"]}
 }
*)
(*CellTagsIndex
CellTagsIndex->{
 {"TextAnnotation", 41769, 1157}
 }
*)
(*NotebookFileOutline
Notebook[{
Cell[580, 21, 5767, 140, 70, "AnchorBarGrid",ExpressionUUID->"68dee2b3-b934-4f91-b975-9b90612acc90",
 CellID->1],
Cell[6350, 163, 107, 0, 70, "ContextNameCell",ExpressionUUID->"f2529dce-5732-4cf7-96e7-a39156e258a4"],
Cell[CellGroupData[{
Cell[6482, 167, 555, 14, 70, "ObjectNameGrid",ExpressionUUID->"5879d6f9-734e-46f2-a0ba-9f4123310aec"],
Cell[7040, 183, 1687, 44, 70, "Usage",ExpressionUUID->"1cc2efe5-a14c-48b7-ad24-a2d9c1e65ce8"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8764, 232, 1443, 34, 70, "NotesSection",ExpressionUUID->"b2d6b45a-17fb-4c42-a22d-b338a988f57e",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->380397612],
Cell[10210, 268, 605, 14, 70, "Notes",ExpressionUUID->"33a66d4c-5537-4e40-9f90-608a3f1aaece"],
Cell[10818, 284, 331, 6, 70, "Notes",ExpressionUUID->"a153cb21-a924-4535-a206-2d3989dbe980"],
Cell[11152, 292, 124, 0, 70, "Notes",ExpressionUUID->"8d529e51-0924-4a2b-adf7-e31a6104adee"],
Cell[11279, 294, 426, 9, 70, "Notes",ExpressionUUID->"9bfecd9e-8821-4d68-8971-e431bf4055fb"],
Cell[11708, 305, 973, 27, 70, "Notes",ExpressionUUID->"764c3cf5-d3bd-474c-8dbe-36e74091cb87"],
Cell[12684, 334, 574, 14, 70, "Notes",ExpressionUUID->"be921984-b20f-48d5-81c7-fca70b5623a5"],
Cell[13261, 350, 1767, 37, 70, "3ColumnTableMod",ExpressionUUID->"ec750a1c-aec8-4724-a4f2-28526c597e0e"]
}, Closed]],
Cell[15043, 390, 80, 0, 70, "PageDelimiter",ExpressionUUID->"65f54ab2-34c2-4c5a-ae5b-22177a914d83"],
Cell[CellGroupData[{
Cell[15148, 394, 1401, 37, 70, "PrimaryExamplesSection",ExpressionUUID->"c8d51a2f-be1a-414a-9fd5-56625cf8942e",
 CellID->283847765],
Cell[16552, 433, 216, 4, 70, "Input",ExpressionUUID->"ab3cf2f6-3501-4be1-bdad-6eb1f85f4cc5",
 CellID->1969679695],
Cell[CellGroupData[{
Cell[16793, 441, 1236, 31, 70, "ExampleSection",ExpressionUUID->"539929a5-02b1-4a09-ad04-e327f6041419",
 CellID->1068206368],
Cell[18032, 474, 366, 9, 70, "ExampleText",ExpressionUUID->"f3e32436-8bb5-47a4-8dfb-22914da696c3",
 CellTags->"TextAnnotation"],
Cell[CellGroupData[{
Cell[18423, 487, 247, 5, 70, "Input",ExpressionUUID->"f531caba-c9c7-408b-a0b6-0608bdb734a1"],
Cell[18673, 494, 122, 1, 70, "Output",ExpressionUUID->"8d80ab6d-5516-4c53-beb0-b7f565ad8a63"]
}, Open  ]],
Cell[CellGroupData[{
Cell[18832, 500, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"572ad977-e107-4ab9-8009-6672ef91c9b2"],
Cell[19059, 507, 173, 3, 70, "ExampleText",ExpressionUUID->"e3cfaf19-40a7-41a9-b073-5651ae1c17cf"],
Cell[CellGroupData[{
Cell[19257, 514, 276, 5, 70, "Input",ExpressionUUID->"50f4eb57-9e88-49b3-b5f9-2c798412a4f5"],
Cell[19536, 521, 122, 1, 70, "Output",ExpressionUUID->"01565ac5-dc61-4cda-8e2f-143de930220f"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[19707, 528, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"ef7aa503-d749-4a67-87b7-6ab75a6c670d"],
Cell[19934, 535, 150, 2, 70, "ExampleText",ExpressionUUID->"ed6d223c-8068-4c57-b1f5-634a28180df5"],
Cell[CellGroupData[{
Cell[20109, 541, 297, 6, 70, "Input",ExpressionUUID->"adfdff70-f536-44d8-a56e-ac702d076f3b"],
Cell[20409, 549, 161, 2, 70, "Output",ExpressionUUID->"f6a0947f-ae63-4521-84a6-a15a8f9d68f8"]
}, Open  ]]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[20631, 558, 1227, 31, 70, "ExampleSection",ExpressionUUID->"1e73c5ed-3bf2-4eb8-8908-00f8b0e0bab5",
 CellID->1293636265],
Cell[21861, 591, 193, 3, 70, "ExampleText",ExpressionUUID->"a3601de2-b22f-4141-910a-3e2955e367cc"],
Cell[CellGroupData[{
Cell[22079, 598, 374, 8, 70, "Input",ExpressionUUID->"45f8fc0a-1334-4226-b480-453543094f68"],
Cell[22456, 608, 108, 1, 70, "Output",ExpressionUUID->"e79106c1-2161-4400-8741-daad3a4d5943"]
}, Open  ]],
Cell[CellGroupData[{
Cell[22601, 614, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"c95c7085-a3ae-4c37-ba42-bc61132f4673"],
Cell[22828, 621, 159, 2, 70, "ExampleText",ExpressionUUID->"2a31a4d8-276d-4044-a589-897e3c82de25"],
Cell[CellGroupData[{
Cell[23012, 627, 362, 7, 70, "Input",ExpressionUUID->"61642e56-212f-4508-907a-6455d2bdedf5"],
Cell[23377, 636, 208, 3, 70, "Output",ExpressionUUID->"c60ab2ff-25f4-4f27-a524-fca52e9a5143"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[23634, 645, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"a0b12ac3-284e-4679-b9a7-eb52081795f4"],
Cell[23861, 652, 213, 3, 70, "ExampleText",ExpressionUUID->"2a8a3e22-359b-48d4-a1b0-78911081c72e"],
Cell[CellGroupData[{
Cell[24099, 659, 507, 13, 70, "Input",ExpressionUUID->"be7b8620-5a0f-4124-b54c-5adc17a3ebd4"],
Cell[24609, 674, 156, 1, 70, "Output",ExpressionUUID->"d6c55903-6856-4830-865b-56f16776e13b"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[24826, 682, 1229, 31, 70, "ExampleSection",ExpressionUUID->"1a989461-bf31-4510-84c4-cb845e752052",
 CellID->2061341341],
Cell[CellGroupData[{
Cell[26080, 717, 1220, 30, 70, "ExampleSubsection",ExpressionUUID->"33948204-384f-490b-a94d-a26316897831"],
Cell[27303, 749, 417, 11, 70, "ExampleText",ExpressionUUID->"b7ecfd0c-5572-4304-9ced-91f6abe6fbe6"],
Cell[CellGroupData[{
Cell[27745, 764, 375, 8, 70, "Input",ExpressionUUID->"b30c8c70-13ce-41e1-8838-7439230ac89a"],
Cell[28123, 774, 110, 1, 70, "Output",ExpressionUUID->"038c6892-6429-47de-bd1a-64dc2df369df"]
}, Open  ]],
Cell[CellGroupData[{
Cell[28270, 780, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"738abe58-3db2-4c1c-a4fe-1f0fdcb0726f"],
Cell[28497, 787, 165, 3, 70, "ExampleText",ExpressionUUID->"c3e29b20-8c8d-410d-93a9-937ca98e8bdc"],
Cell[CellGroupData[{
Cell[28687, 794, 460, 10, 70, "Input",ExpressionUUID->"4bea368f-b417-4bbc-bdfd-6bef0c9b56ae"],
Cell[29150, 806, 108, 1, 70, "Output",ExpressionUUID->"3b7ab9f9-4e39-45b7-b833-5a0fb989d35d"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell[29331, 815, 1244, 31, 70, "ExampleSection",ExpressionUUID->"ceb0c6fd-a9db-4f0a-a093-f6d2da3b4578",
 CellID->2123667759],
Cell[30578, 848, 519, 13, 70, "ExampleText",ExpressionUUID->"1eb4817c-f110-4319-9fc1-29125192015f"],
Cell[CellGroupData[{
Cell[31122, 865, 412, 9, 70, "Input",ExpressionUUID->"321d83e5-4e9a-4806-9a86-26eeeadb53d2"],
Cell[31537, 876, 388, 9, 70, "Output",ExpressionUUID->"13c438ae-f6ba-4185-9bd1-4bf5b0b40775"]
}, Open  ]],
Cell[CellGroupData[{
Cell[31962, 890, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"fa88979c-5315-4125-98a2-61379c3d7b60"],
Cell[32189, 897, 185, 3, 70, "ExampleText",ExpressionUUID->"3bc545b3-f787-4d14-baf4-7765afe00f68"],
Cell[CellGroupData[{
Cell[32399, 904, 385, 9, 70, "Input",ExpressionUUID->"9c578f27-5636-44a1-98e1-57416a574357"],
Cell[32787, 915, 111, 1, 70, "Output",ExpressionUUID->"60df6de0-15bd-4fe0-9d11-a981a558fef8"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[32959, 923, 1237, 31, 70, "ExampleSection",ExpressionUUID->"ec7bd910-f78a-4bda-855f-b92f0f0dc2e3",
 CellID->1305812373],
Cell[34199, 956, 196, 3, 70, "ExampleText",ExpressionUUID->"c97234e6-9ae1-4e44-8c20-384bd1d42a8e"],
Cell[CellGroupData[{
Cell[34420, 963, 253, 5, 70, "Input",ExpressionUUID->"aebf3cf1-e2c5-4ae4-a835-1d7fdec184c7"],
Cell[34676, 970, 201, 4, 70, "Output",ExpressionUUID->"3dfd5a14-d8da-4ceb-96a0-0b4f95cb15a1"]
}, Open  ]],
Cell[CellGroupData[{
Cell[34914, 979, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"01b5ff99-3ecd-436c-be5b-e1f73fe1f2c9"],
Cell[35141, 986, 147, 2, 70, "ExampleText",ExpressionUUID->"9bdf9570-f04a-40a4-9fd6-2b905bab8eaa"],
Cell[CellGroupData[{
Cell[35313, 992, 254, 5, 70, "Input",ExpressionUUID->"f4f22243-5ba1-4863-a64d-5526334dbb20"],
Cell[35570, 999, 202, 4, 70, "Output",ExpressionUUID->"0bbb76b0-f484-4358-9d5e-4ab5ce1240a8"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],
Cell[35823, 1009, 3120, 82, 70, "SeeAlsoSection",ExpressionUUID->"767332ed-3de4-476f-b327-d8d8f3e00b9d"],
Cell[38946, 1093, 698, 19, 70, "MoreAboutSection",ExpressionUUID->"c5e34f80-55a7-4f00-b812-5020e4cac07a"],
Cell[39647, 1114, 78, 0, 70, "FooterCell",ExpressionUUID->"96552515-aecf-437e-896e-a5760bc85d84"]
}
]
*)

(* End of internal cache information *)

