(* 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[     44438,       1148]
NotebookOptionsPosition[     37188,       1025]
NotebookOutlinePosition[     39996,       1081]
CellTagsIndexPosition[     39953,       1078]
WindowTitle->WienerAttack
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->
           "f254e111-6a40-4a9f-98c2-496794095295"], 
          TemplateBox[{8},
           "Spacer1"]}]],
         TextAlignment->Center,ExpressionUUID->
         "cdd087cc-180f-4726-b5ce-ad7c5eaabfa8"],
        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->
           "53f5ad89-09e7-4740-af05-a58849a2ed88"]
         }],ExpressionUUID->"39e85935-be26-439e-83f0-635bd37e6a7f"],
         StripOnInput->False],{
        StyleBox[
          "\"ContinuedFraction\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup["paclet:ref/ContinuedFraction"], 
         StyleBox["\"Convergents\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup["paclet:ref/Convergents"], 
         StyleBox["\"PowerMod\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup["paclet:ref/PowerMod"], Delimiter, 
         StyleBox[
          "\"Functions\"", "SeeAlsoSection", FontSize -> 14, FontSlant -> 
           "Italic", StripOnInput -> False] :> 
         NotebookFind[EvaluationNotebook[], "SeeAlsoSection", All, CellStyle],
          StyleBox[
          StyleBox[
           "\"WienerBound\"", "SeeAlsoRelated", StripOnInput -> False], 
           "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/WienerBound"], 
         StyleBox[
          StyleBox["\"BatchGCD\"", "SeeAlsoRelated", StripOnInput -> False], 
           "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/BatchGCD"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"SeeAlso"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "8fb28674-6976-4fe6-98d7-5a09211326b3"],
     "\[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->
           "4880b7e2-48b3-4e7d-ad27-eeaeda9325d4"]
         }],ExpressionUUID->"dfe22202-bfb8-453b-8901-544725685d02"],
         StripOnInput->False],{
        "\"Search\"" :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/guide/Search"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"MoreAbout"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "ed3435b7-23b6-4f5a-b434-85539978078e"],
     "\[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->
           "5fbe201a-7c19-45c9-923a-18eb86c2992d"]
         }],ExpressionUUID->"5c2666fc-f7ca-4b2e-b4fc-9adbb3847167"],
         StripOnInput->False],{
        "\"WolframInstitute/Puzzles/ref/WienerAttack\"" :> None, 
         "\"Copy Wolfram Documentation Center URL\"" :> 
         CopyToClipboard["WolframInstitute/Puzzles/ref/WienerAttack"], 
         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/WienerAttack.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/WienerAttack" <> ".html"], 
              None}]}]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"URLMenu"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "97d70a01-9e9d-4767-a975-4e034df067c7"]
    }], "AnchorBar",
     CacheGraphics->False,ExpressionUUID->
     "aac3d849-2124-4aa1-9e93-324ec01b60d3"]}
  }]], "AnchorBarGrid",
 CellID->1,ExpressionUUID->"82840082-fdf4-45f8-bf1a-9592ecba7ac1"],

Cell["WolframInstitute`Puzzles`", "ContextNameCell",ExpressionUUID->"b10a9cfd-5223-4ae1-80e8-5ae09b8f5bdc"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {Cell[TextData[{
     Cell[
     "WienerAttack", "ObjectName",ExpressionUUID->
      "e11f1e3c-3c81-4a4a-a6d0-18d53601d48d"],
     Cell[BoxData[
      TemplateBox[{8},
       "Spacer1"]],ExpressionUUID->"08b850d6-cdff-4e44-a812-42d006fdfa6e"],
     Cell[BoxData[
     ""], "ObjectNameTranslation",ExpressionUUID->
      "89667db3-7a70-46a9-a532-01627833049c"]
    }],ExpressionUUID->"5b9560c7-59ef-429f-9196-499df6653cd9"], 
    "\[SpanFromLeft]"}
  }]], "ObjectNameGrid",ExpressionUUID->"b4073c1c-1068-49b9-9659-\
9cbee98d4c9f"],

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["WienerAttack"]], 
         "paclet:WolframInstitute/Puzzles/ref/WienerAttack", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["n", "TI"], ",", " ", 
        StyleBox["e", "TI"]}], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "a7e125be-d4ef-444d-888f-239ff01b2e68"],
     "\[LineSeparator]",
     "recovers the RSA private key from the public key ",
     StyleBox["n", "TI"],
     ", ",
     StyleBox["e", "TI"],
     " by testing every convergent of the continued fraction of ",
     StyleBox["e", "TI"],
     "/",
     StyleBox["n", "TI"],
     ", and gives an Association with the ",
     Cell[BoxData["\"\<PrivateExponent\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "ae5ab1d7-b44d-4270-942e-052f5bd9222d"],
     ", the ",
     Cell[BoxData["\"\<Factors\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "7a587c4b-b0d7-48aa-b909-09dde0543a88"],
     " {",
     StyleBox["p", "TI"],
     ", ",
     StyleBox["q", "TI"],
     "} of ",
     StyleBox["n", "TI"],
     " with ",
     StyleBox["p", "TI"],
     " > ",
     StyleBox["q", "TI"],
     ", the ",
     Cell[BoxData["\"\<Totient\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "7e90dfdc-7424-47b7-82ba-74969944c517"],
     ", the ",
     Cell[BoxData["\"\<TotientQuotient\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "29426e8e-f2d4-4c92-8405-04c93e5b6584"],
     ", the ",
     Cell[BoxData["\"\<ConvergentIndex\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "f933cc15-0427-4795-8943-d7361a174f40"],
     " the key was found at, the ",
     Cell[BoxData["\"\<Approximant\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "0d70cb10-2b48-4977-8028-f7b520926e6a"],
     " used and the ",
     Cell[BoxData["\"\<Bound\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "16a4d0dc-bacc-40c2-8729-59f26fccb44b"],
     " recovery is guaranteed below."
    }],ExpressionUUID->"bb6e9f60-3ae3-4162-ac53-1c6ad6f3aaef"]},
   {"", Cell[TextData[{
     "The option ",
     Cell[BoxData["\"\<Approximant\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "09a51f30-74a3-45f2-9bc8-250f46f725d9"],
     " chooses which rational is expanded. The default ",
     Cell[BoxData["\"\<deWeger\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "022f5a18-ae83-4b2f-b69a-f25c515c418d"],
     " expands ",
     StyleBox["e", "TI"],
     "/(",
     StyleBox["n", "TI"],
     " + 1 - 2 \[LeftFloor]\[Sqrt]",
     StyleBox["n", "TI"],
     "\[RightFloor]), which succeeds when the private exponent is below ",
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["WienerBound"]], 
         "paclet:WolframInstitute/Puzzles/ref/WienerBound", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       RowBox[{
        StyleBox["n", "TI"], ",", " ", 
        RowBox[{
         StyleBox["p", "TI"], " ", "-", " ", 
         StyleBox["q", "TI"]}]}], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "3f5d52f9-4d58-4e9a-9c7f-6f3f7f5271ca"],
     "; ",
     Cell[BoxData["\"\<Wiener\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "a582f7a6-65a5-456d-a051-f56cc3c26e8b"],
     " expands ",
     StyleBox["e", "TI"],
     "/",
     StyleBox["n", "TI"],
     " itself, the textbook attack, which needs the primes to be balanced."
    }],ExpressionUUID->"59c408b1-720e-4a37-b289-1ba2f1f2cb99"]},
   {"", Cell[TextData[{
     "The option ",
     Cell[BoxData["\"\<MaxTotientQuotient\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "85850d23-c10e-410c-98e5-85d6f603ad99"],
     " reaches a key whose exponent was inverted modulo the Carmichael \
\[Lambda](",
     StyleBox["n", "TI"],
     ") rather than the Euler totient, by solving ",
     StyleBox["e", "TI"],
     " ",
     StyleBox["D", "TI"],
     " - ",
     StyleBox["G", "TI"],
     " == ",
     StyleBox["k", "TI"],
     " \[CurlyPhi] for every ",
     StyleBox["G", "TI"],
     " up to the setting and reporting ",
     StyleBox["d", "TI"],
     " = ",
     StyleBox["D", "TI"],
     "/",
     StyleBox["G", "TI"],
     ". The default 1 is Wiener's theorem exactly."
    }],ExpressionUUID->"21397b63-a48e-4f64-8c96-7c63fefa7b21"]}
  }]], "Usage",ExpressionUUID->"22a7b08e-3142-42c9-ad16-052a7291f6aa"]
}, 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->"e00e720b-527f-4367-9fc6-8015c7c6d9ce"],
  Cell[BoxData[
   TemplateBox[{1},
    "Spacer1"]],ExpressionUUID->"019cf2cd-5f9a-4966-9164-0933861934f2"],
  "Details and Options"
 }], "NotesFrameText",ExpressionUUID->
  "e5333d53-6bbe-4acd-b973-7f5af25d096b"]],ExpressionUUID->"086b8aba-b7a1-\
4608-91b0-33cb3be63cf2"]], "NotesSection",
 ShowGroupOpener->"Thumbnail",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CacheGraphics->False,
 CellID->404990980,ExpressionUUID->"4a157b27-5e34-4c78-b6c2-07a143842a63"],

Cell[TextData[{
 "The attack exists because ",
 StyleBox["e", "TI"],
 " ",
 StyleBox["d", "TI"],
 " - ",
 StyleBox["k", "TI"],
 " \[CurlyPhi](",
 StyleBox["n", "TI"],
 ") = 1 forces ",
 StyleBox["k", "TI"],
 "/",
 StyleBox["d", "TI"],
 " to be a convergent of ",
 StyleBox["e", "TI"],
 "/",
 StyleBox["n", "TI"],
 " once ",
 StyleBox["d", "TI"],
 " is small enough. There are only O(log ",
 StyleBox["n", "TI"],
 ") convergents, so the scan is cheap even for a 2048-bit modulus."
}], "Notes",ExpressionUUID->"38923d94-7e18-4fc1-ad8e-7310ebbaabad"],

Cell[TextData[{
 "A candidate is accepted only when the totient it implies splits ",
 StyleBox["n", "TI"],
 " exactly ",
 StyleBox["and",
  FontWeight->"Bold"],
 " the recovered exponent inverts ",
 StyleBox["e", "TI"],
 " modulo \[Lambda](",
 StyleBox["n", "TI"],
 "). Both tests are exact integer arithmetic, so a returned key is always \
correct and there is no false-accept path."
}], "Notes",ExpressionUUID->"bc7edc49-2e2d-437f-8395-59eed56b6429"],

Cell[TextData[{
 "A ",
 Cell[BoxData["Failure"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "dd7b8e02-9457-4bae-bfdf-c57e72510f63"],
 " means these attacks did not apply. It is ",
 StyleBox["not",
  FontWeight->"Bold"],
 " evidence that the key is sound: Boneh\[Dash]Durfee reaches ",
 StyleBox["d", "TI"],
 " < ",
 StyleBox["n", "TI"],
 "^0.292 by Coppersmith lattice methods and is out of scope here."
}], "Notes",ExpressionUUID->"00ac83d9-c136-4da4-96dc-9d0d2dddb7cd"],

Cell[TextData[{
 "The textbook bound assumes ",
 StyleBox["n", "TI"],
 " = ",
 StyleBox["p", "TI"],
 " ",
 StyleBox["q", "TI"],
 " with ",
 StyleBox["q", "TI"],
 " < ",
 StyleBox["p", "TI"],
 " < 2 ",
 StyleBox["q", "TI"],
 ". The default ",
 Cell[BoxData["\<\"deWeger\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "52d5a8fb-59ce-4555-b7cf-e1c90f724515"],
 " approximant replaces that hypothesis with an explicit dependence on |",
 StyleBox["p", "TI"],
 " - ",
 StyleBox["q", "TI"],
 "|. Since the hypothesis already forces that difference below \[Sqrt]",
 StyleBox["n", "TI"],
 ", the default is at least as strong wherever the textbook attack applies, \
and stronger the closer together the primes are \[LongDash] which is the case \
de Weger's paper is about."
}], "Notes",ExpressionUUID->"e6fc1aba-e854-45c6-9427-9f0e43dbe4a7"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["FactorInteger"]], "paclet:ref/FactorInteger"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "b925c6af-3d7b-45e2-b66e-7f9fc5ddca05"],
 " is the right tool for a modulus small enough to factor outright. This \
function is for a modulus that is far too large for that but was generated \
with a small private exponent."
}], "Notes",ExpressionUUID->"d34a12dd-9945-4d86-bd0a-b76f7a18717c"],

Cell[TextData[{
 "All arithmetic is exact. No ",
 Cell[BoxData["Sqrt"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "4382ffc8-af30-453b-927c-caf414b2f335"],
 " is ever applied to an integer, because at the default ",
 Cell[BoxData["$MaxExtraPrecision"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "79134d73-5bf2-46c4-98ad-76231a15282d"],
 " those expressions go unevaluated on large near-squares rather than raising \
a message."
}], "Notes",ExpressionUUID->"6d0da359-42a9-4e87-9a81-9e9749bf6d82"],

Cell[BoxData[GridBox[{
   {Cell["      ", "TableRowIcon",ExpressionUUID->
     "7c3f77f2-8639-49fe-9340-13d3bed6755b"], Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"fec8115e-1944-4db7-b035-316a171b1636"],
     Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"a4e0e917-80fc-4f92-ab63-127a10ccc38b"],
     Cell["", "TableText",
     FontWeight->Bold,ExpressionUUID->"f554f017-a366-4d88-83e5-237205a8b9f4"]},
   {Cell["      ", "TableRowIcon",ExpressionUUID->
     "9209dfe8-64ba-434a-815d-10b0ee9cbc46"], Cell[TextData[Cell[
    BoxData["\"\<Approximant\>\""], "InlineFormula",
     FontFamily->"Source Sans Pro",
     FontSize->0.9 Inherited,ExpressionUUID->
     "5934d43f-1d0a-4e99-bed8-7512269e617f"]], "TableText",ExpressionUUID->
     "4fc65403-0b49-4b48-a384-4f33d11190c8"], Cell[TextData[Cell[
    BoxData["\"\<deWeger\>\""], "InlineFormula",
     FontFamily->"Source Sans Pro",
     FontSize->0.9 Inherited,ExpressionUUID->
     "5711606d-8dc0-42aa-8d1f-02c4b0f08166"]], "TableText",ExpressionUUID->
     "f84b7ae3-e5e9-44a3-af61-98ab2d766a53"], Cell[TextData[{
     "which rational to expand: ",
     Cell[BoxData["\"\<deWeger\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "f0cfc16b-c47f-44d6-946d-3fbe2bb971a4"],
     " or ",
     Cell[BoxData["\"\<Wiener\>\""], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "69b522d0-1b5d-4b65-8c49-5abc46656f20"]
    }], "TableText",ExpressionUUID->"8b915ffb-08f7-4927-b050-9b8732ec08ce"]},
   {Cell["      ", "TableRowIcon",ExpressionUUID->
     "bb3368ad-c7cd-4c18-ae2b-c5d026e653a1"], Cell[TextData[Cell[
    BoxData["\"\<MaxTotientQuotient\>\""], "InlineFormula",
     FontFamily->"Source Sans Pro",
     FontSize->0.9 Inherited,ExpressionUUID->
     "76efeaec-57c5-499c-a302-a6909d7da107"]], "TableText",ExpressionUUID->
     "4280701a-5392-4850-8b67-cfa7924cbbb6"], Cell[
    "1", "TableText",ExpressionUUID->"d436352c-1112-4928-83fb-e10d6c7d4a60"], 
    Cell[TextData[{
     "largest totient quotient ",
     StyleBox["G", "TI"],
     " to solve for; 1 is Wiener's theorem"
    }], "TableText",ExpressionUUID->"7374599d-da5f-4c6a-b05e-d141c9984de4"]}
  }]], "3ColumnTableMod",
 GridBoxOptions->{
 GridBoxBackground->{"Columns" -> {{None}}, "Rows" -> {None, None, {None}}},
 GridBoxDividers->{
  "Rows" -> {{
     True, True, True, 
      True}}}},ExpressionUUID->"c5ff10c8-c4e2-4766-9d19-bdda6f600815"]
}, Closed]],

Cell["", "PageDelimiter",ExpressionUUID->"ffd977a4-330c-40b5-be9e-35b5bfc9e0b4"],

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->"fb97173d-33a4-4524-9cbb-8497352b5275"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"909fc26f-8e52-4255-b275-b21cb0e98ebe"],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "9e6701f2-e609-4523-8f0a-de5ef4a7172d"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1307723517,ExpressionUUID->"29974fa6-c45b-4f74-b5dc-aa0f00a5364c"],

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<WolframInstitute`Puzzles`\>\"", "]"}]], "Input", \
"ExampleInitialization",
 CellLabel->"In[1]:=",
 CellID->1969679695,ExpressionUUID->"3bad86ec-74b5-48fb-acf0-0172017b9e28"],

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->
  "363f8d59-84e2-47c6-af58-ff1fed0b794a"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"75329c12-fc4c-412d-9b76-ef9598e0e44e"],
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(1)", "ExampleCount",ExpressionUUID->
  "8d70b8e2-9171-4b02-ba75-4f2e3966667f"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1561506821,ExpressionUUID->"3a6ef5ca-ef05-4fe8-8b3f-222eda2a2e92"],

Cell["\<\
The worked example from Wiener's attack, with a 5-digit modulus:\
\>", "ExampleText",ExpressionUUID->"718a7679-d851-4ec8-a65d-bc132732782e"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"WienerAttack", "[", 
  RowBox[{"90581", ",", " ", "17993"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"b55ba68e-ce54-4f53-9953-e871ab659992"],

Cell[BoxData[
 RowBox[{"\[LeftAssociation]", 
  RowBox[{
   RowBox[{"\<\"PrivateExponent\"\>", "\[Rule]", "5"}], ",", 
   RowBox[{"\<\"Factors\"\>", "\[Rule]", 
    RowBox[{"{", 
     RowBox[{"379", ",", "239"}], "}"}]}], ",", 
   RowBox[{"\<\"Totient\"\>", "\[Rule]", "89964"}], ",", 
   RowBox[{"\<\"TotientQuotient\"\>", "\[Rule]", "1"}], ",", 
   RowBox[{"\<\"ConvergentIndex\"\>", "\[Rule]", "2"}], ",", 
   RowBox[{"\<\"Approximant\"\>", "\[Rule]", "\<\"deWeger\"\>"}], ",", 
   RowBox[{"\<\"Bound\"\>", "\[Rule]", "5"}]}], 
  "\[RightAssociation]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"79c44fae-bc63-4fff-beac-8425ede06731"]
}, Open  ]],

Cell[TextData[{
 "The key was the second convergent of ",
 StyleBox["e", "TI"],
 "/",
 StyleBox["n", "TI"],
 ":"
}], "ExampleText",ExpressionUUID->"c3749a68-99f7-4871-aa2b-11d9fade8177"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Convergents", "[", 
  RowBox[{"17993", "/", "90581"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[2]:=",ExpressionUUID->"1dd9d5cf-85d0-4648-a812-97af2a2214de"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"0", ",", 
   FractionBox["1", "5"], ",", 
   FractionBox["29", "146"], ",", 
   FractionBox["117", "589"], ",", 
   FractionBox["146", "735"], ",", 
   FractionBox["555", "2794"], ",", 
   FractionBox["1256", "6323"], ",", 
   FractionBox["5579", "28086"], ",", 
   FractionBox["17993", "90581"]}], "}"}]], "Output",
 CellLabel->"Out[2]= ",ExpressionUUID->"9182e9fc-a9a5-4dba-8109-a1221f6bd9af"]
}, Open  ]],

Cell["\<\
A 512-bit modulus whose private exponent is 7, recovered and then used to \
decrypt:\
\>", "ExampleText",ExpressionUUID->"83dc52c6-0511-4ca4-96ce-8f451b164e98"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"With", "[", "\n", "\t", 
  RowBox[{
   RowBox[{"{", "\n", "\t\t", 
    RowBox[{
     RowBox[{
     "n", " ", "=", " ", 
      "67270759904007386873457251338310685485051599090892269093081511054056173\
840933739311418333016536024767844140655045369791640895817893541737197858159723\
24079"}], ",", "\n", "\t\t", 
     RowBox[{
     "e", " ", "=", " ", 
      "48050542788576704909612322384507632489322570779208763637915365038611552\
743522891345050097418639182479215155461773911271754635447413682257219577984161\
07743"}], ",", "\n", "\t\t", 
     RowBox[{
     "c", " ", "=", " ", 
      "59281209448771540924881596067927582834904693644448921679423458017133739\
626176287570534122326362199676752565104229849488729549496165213925427039154780\
27634"}]}], "\n", "\t", "}"}], ",", "\n", "\t", 
   RowBox[{"FromCharacterCode", "[", 
    RowBox[{"IntegerDigits", "[", 
     RowBox[{
      RowBox[{"PowerMod", "[", 
       RowBox[{"c", ",", " ", 
        RowBox[{
         RowBox[{"WienerAttack", "[", 
          RowBox[{"n", ",", " ", "e"}], "]"}], "[", "\"\<PrivateExponent\>\"",
          "]"}], ",", " ", "n"}], "]"}], ",", " ", "256"}], "]"}], "]"}]}], 
  "\n", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[3]:=",ExpressionUUID->"ceb83544-b96c-4d65-b0b6-c6f982f8f95c"],

Cell[BoxData["\<\"Wiener's attack success!\"\>"], "Output",
 CellLabel->"Out[3]= ",ExpressionUUID->"1492dcdc-1125-4bcf-af1e-e74d7e1c0b72"]
}, Open  ]],

Cell["\<\
A standard public exponent on that same modulus is not recoverable:\
\>", "ExampleText",ExpressionUUID->"18b00d15-683b-405e-bbcd-d6b037e37169"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Head", "[", 
  RowBox[{"WienerAttack", "[", 
   RowBox[{
   "67270759904007386873457251338310685485051599090892269093081511054056173840\
933739311418333016536024767844140655045369791640895817893541737197858159723240\
79", ",", " ", "65537"}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[4]:=",ExpressionUUID->"f08d276e-3edc-48bb-8a5c-0199f1c9aae2"],

Cell[BoxData["Failure"], "Output",
 CellLabel->"Out[4]= ",ExpressionUUID->"4382f2fc-97f3-4755-a455-0f7b09d7306e"]
}, 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->
  "6a7c1cbf-e5c4-4d0e-b38b-2a65db6a9289"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"22c14449-a0fa-4f31-9e87-c1086a21d94a"],
 "Possible Issues",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(1)", "ExampleCount",ExpressionUUID->
  "404674cb-aa38-432d-b6e3-5fe19ad5261b"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1305812373,ExpressionUUID->"cff94819-2fad-4af9-89d2-dde8b094f5de"],

Cell[TextData[{
 "A ",
 Cell[BoxData["Failure"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "0b27da0b-7c99-4986-a501-d8abfbd82d37"],
 " is not a clean bill of health. The scan rules out a private exponent below \
the reported ",
 Cell[BoxData["\<\"Bound\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "90b4fe67-0aaf-416b-9f08-13b6773e03e1"],
 " and nothing more; Boneh\[Dash]Durfee still reaches ",
 StyleBox["d", "TI"],
 " < ",
 StyleBox["n", "TI"],
 "^0.292, and it is not implemented here."
}], "ExampleText",ExpressionUUID->"631fd5c8-cd33-46f5-806f-9d48f7199c2b"],

Cell[TextData[{
 "The reported ",
 Cell[BoxData["\<\"Bound\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "d90a7aeb-a81d-4b21-ae73-17e76a843833"],
 " is always Wiener's, so on a modulus whose primes are close together the \
default reaches well past it. Here the two primes differ by 42 and the \
private exponent is three times ",
 Cell[BoxData[
  RowBox[{
   TemplateBox[{
     Cell[
      TextData["WienerBound"]], 
     "paclet:WolframInstitute/Puzzles/ref/WienerBound", 
     "WolframInstitute/Puzzles Package Symbol"},
    "PackageLink",
    BaseStyle->"InlineFormula"], "[", 
   StyleBox["n", "TI"], "]"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "d21b73a2-08ea-448e-bd75-a22bcccec6b6"],
 ", so the textbook approximant misses it:"
}], "ExampleText",ExpressionUUID->"239129bc-95bd-44b5-9e92-d89c5b9e3edb"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Head", "[", 
  RowBox[{"WienerAttack", "[", 
   RowBox[{"10000005600000343", ",", " ", "5806938281143367", ",", " ", 
    RowBox[{"\"\<Approximant\>\"", " ", "->", " ", "\"\<Wiener\>\""}]}], 
   "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"cb6d6bf9-183e-457f-a4ff-4b8f2708c57f"],

Cell[BoxData["Failure"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"32a695dd-5167-44c8-a77b-e35422743001"]
}, Open  ]],

Cell[TextData[{
 "while the default recovers it, because the threshold that actually governs \
is ",
 Cell[BoxData[
  RowBox[{
   TemplateBox[{
     Cell[
      TextData["WienerBound"]], 
     "paclet:WolframInstitute/Puzzles/ref/WienerBound", 
     "WolframInstitute/Puzzles Package Symbol"},
    "PackageLink",
    BaseStyle->"InlineFormula"], "[", 
   RowBox[{
    StyleBox["n", "TI"], ",", " ", 
    RowBox[{
     StyleBox["p", "TI"], " ", "-", " ", 
     StyleBox["q", "TI"]}]}], "]"}]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "30012ff6-3c60-4321-af87-cc761b512e27"],
 ", which for this modulus is 23809533809 rather than 3333:"
}], "ExampleText",ExpressionUUID->"7904e583-4cde-4991-87ab-96e6d19ccea0"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"WienerAttack", "[", 
   RowBox[{"10000005600000343", ",", " ", "5806938281143367"}], "]"}], 
  "[", "\"\<PrivateExponent\>\"", "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[2]:=",ExpressionUUID->"496a5f83-ce96-4dc7-93b3-596f9bb02f32"],

Cell[BoxData["10007"], "Output",
 CellLabel->"Out[2]= ",ExpressionUUID->"25078f6f-9231-4d01-a7b2-fada76862f68"]
}, Open  ]],

Cell[TextData[{
 "Neither approximant helps on a ",
 StyleBox["lopsided", "TI"],
 " modulus, where |",
 StyleBox["p", "TI"],
 " - ",
 StyleBox["q", "TI"],
 "| is much larger than \[Sqrt]",
 StyleBox["n", "TI"],
 ": the textbook hypothesis ",
 StyleBox["q", "TI"],
 " < ",
 StyleBox["p", "TI"],
 " < 2 ",
 StyleBox["q", "TI"],
 " fails, and de Weger's threshold shrinks correspondingly. A modulus with \
one tiny prime is a job for ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["FactorInteger"]], "paclet:ref/FactorInteger"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "e1c6195d-7b69-4f05-a8f2-717610eae3d9"],
 ", not for this function."
}], "ExampleText",ExpressionUUID->"8e694853-ddf7-44c5-9598-1fef6d0dd015"],

Cell[TextData[{
 "Raising ",
 Cell[BoxData["\<\"MaxTotientQuotient\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "91dde940-a395-4eb7-bf89-19e2371a1920"],
 " widens the search but costs proportionally, since every convergent is \
retried for every quotient. Leave it at 1 unless a key is suspected of having \
been derived modulo the Carmichael \[Lambda](",
 StyleBox["n", "TI"],
 ")."
}], "ExampleText",ExpressionUUID->"a6a61453-f16d-4d11-9f6b-5c315adcc185"]
}, Closed]]
}, Open  ]],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, 
       "RelatedFunction.png"]],
     ImageSizeCache->{50., {26.47265625, 33.52734375}}], GridBox[{
      {
       StyleBox[
        RowBox[{"See", " ", "Also"}], "SeeAlsoSection"]},
      {Cell[TextData[{
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["WienerBound"]], 
           "paclet:WolframInstitute/Puzzles/ref/WienerBound", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "d158bc72-37f3-4e25-9ec0-6d760a9aaea5"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["BatchGCD"]], 
           "paclet:WolframInstitute/Puzzles/ref/BatchGCD", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "b9abbfa2-c034-4b0b-890c-1b72800cda06"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["ContinuedFraction"]], "paclet:ref/ContinuedFraction"},
          "RefLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "140b619d-b7fa-4043-acd9-0b9d8d25930d"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Convergents"]], "paclet:ref/Convergents"},
          "RefLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "9ee65613-ae38-499d-b3d6-3a709fda15db"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["PowerMod"]], "paclet:ref/PowerMod"},
          "RefLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "f519f34a-b4ad-416c-ad3a-9079e2ffc936"]
       }], "SeeAlso",ExpressionUUID->"22cfd50b-15c7-40fb-ae1f-8660c0835663"]}
     }]}
  }]], "SeeAlsoSection",ExpressionUUID->"3848b23f-77de-449f-bd19-\
321949f45d89"],

Cell[BoxData[GridBox[{
   {
    DynamicBox[FEPrivate`ImportImage[
      FrontEnd`FileName[{"Documentation", "FooterIcons"}, "RelatedGuide.png"]],
     ImageSizeCache->{50., {26.47265625, 33.52734375}}], GridBox[{
      {
       StyleBox[
        RowBox[{"Related", " ", "Guides"}], "MoreAboutSection"]},
      {
       RowBox[{"\[FilledVerySmallSquare]", Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["Search"]], 
           "paclet:WolframInstitute/Puzzles/guide/Search"},
          "RefLinkPlain",
          BaseStyle->{"MoreAbout"}]], "MoreAbout",ExpressionUUID->
         "1962cac7-c68a-4505-8826-b90ac9e71f7e"]}]}
     }]}
  }]], "MoreAboutSection",ExpressionUUID->"f1134478-f9ab-4277-ba49-\
cf5fd23a5c89"],

Cell[" ", "FooterCell",ExpressionUUID->"d0015283-a18e-4a10-a4c2-ae02f3271236"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{900, 830},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
WindowTitle->"WienerAttack",
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, 57.847675}", 
    "history" -> {"XX", "", "", ""}, "context" -> "WolframInstitute`Puzzles`",
     "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Wolfram Institute/ Puzzles Symbol", "language" -> "en", "paclet" -> 
    "WolframInstitute/Puzzles", "status" -> "None", "summary" -> 
    "PackageLink[WienerAttack,paclet : \
WolframInstitute/Puzzles/ref/WienerAttack, WolframInstitute/Puzzles Package \
Symbol][n, e] recovers the RSA private key from the public key n, e by \
testing every convergent of the continued fraction of e/n, and gives an \
Association with the PrivateExponent, the Factors {p, q} of n with p > q, the \
Totient, the TotientQuotient, the ConvergentIndex the key was found at, the \
Approximant used and the Bound recovery is guaranteed below. The option \
Approximant chooses which rational is expanded. The default deWeger expands \
e/(n + 1 - 2 \\[LeftFloor]\\[Sqrt]n\\[RightFloor]), which succeeds when the \
private exponent is below PackageLink[WienerBound,paclet : \
WolframInstitute/Puzzles/ref/WienerBound, WolframInstitute/Puzzles Package \
Symbol][n, p - q]; Wiener expands e/n itself, the textbook attack, which \
needs the primes to be balanced. The option MaxTotientQuotient reaches a key \
whose exponent was inverted modulo the Carmichael \\[Lambda](n) rather than \
the Euler totient, by solving e D - G == k \\[CurlyPhi] for every G up to the \
setting and reporting d = D/G. The default 1 is Wiener's theorem exactly.", 
    "synonyms" -> {}, "tabletags" -> {}, "title" -> "WienerAttack", 
    "titlemodifier" -> "", "metadescription" -> "", "windowtitle" -> 
    "WienerAttack", "type" -> "Symbol", "uri" -> 
    "WolframInstitute/Puzzles/ref/WienerAttack", "WorkflowDockedCell" -> ""}, 
  "SearchTextTranslated" -> ""},
CellContext->CellGroup,
FrontEndVersion->"15.0 for Mac OS X ARM (64-bit) (May 19, 2026)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Reference.nb"],
ExpressionUUID->"c745946e-3e04-4268-bbf3-f98f9a2b5f9e"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[580, 21, 6015, 145, 70, "AnchorBarGrid",ExpressionUUID->"82840082-fdf4-45f8-bf1a-9592ecba7ac1",
 CellID->1],
Cell[6598, 168, 107, 0, 70, "ContextNameCell",ExpressionUUID->"b10a9cfd-5223-4ae1-80e8-5ae09b8f5bdc"],
Cell[CellGroupData[{
Cell[6730, 172, 555, 14, 70, "ObjectNameGrid",ExpressionUUID->"b4073c1c-1068-49b9-9659-9cbee98d4c9f"],
Cell[7288, 188, 5283, 146, 70, "Usage",ExpressionUUID->"22a7b08e-3142-42c9-ad16-052a7291f6aa"]
}, Open  ]],
Cell[CellGroupData[{
Cell[12608, 339, 1443, 34, 70, "NotesSection",ExpressionUUID->"4a157b27-5e34-4c78-b6c2-07a143842a63",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->404990980],
Cell[14054, 375, 547, 22, 70, "Notes",ExpressionUUID->"38923d94-7e18-4fc1-ad8e-7310ebbaabad"],
Cell[14604, 399, 452, 12, 70, "Notes",ExpressionUUID->"bc7edc49-2e2d-437f-8395-59eed56b6429"],
Cell[15059, 413, 523, 14, 70, "Notes",ExpressionUUID->"00ac83d9-c136-4da4-96dc-9d0d2dddb7cd"],
Cell[15585, 429, 887, 27, 70, "Notes",ExpressionUUID->"e6fc1aba-e854-45c6-9427-9f0e43dbe4a7"],
Cell[16475, 458, 553, 13, 70, "Notes",ExpressionUUID->"d34a12dd-9945-4d86-bd0a-b76f7a18717c"],
Cell[17031, 473, 600, 13, 70, "Notes",ExpressionUUID->"6d0da359-42a9-4e87-9a81-9e9749bf6d82"],
Cell[17634, 488, 2511, 50, 70, "3ColumnTableMod",ExpressionUUID->"c5ff10c8-c4e2-4766-9d19-bdda6f600815"]
}, Closed]],
Cell[20160, 541, 80, 0, 70, "PageDelimiter",ExpressionUUID->"ffd977a4-330c-40b5-be9e-35b5bfc9e0b4"],
Cell[CellGroupData[{
Cell[20265, 545, 1401, 37, 70, "PrimaryExamplesSection",ExpressionUUID->"29974fa6-c45b-4f74-b5dc-aa0f00a5364c",
 CellID->1307723517],
Cell[21669, 584, 216, 4, 70, "Input",ExpressionUUID->"3bad86ec-74b5-48fb-acf0-0172017b9e28",
 CellID->1969679695],
Cell[CellGroupData[{
Cell[21910, 592, 1236, 31, 70, "ExampleSection",ExpressionUUID->"3a6ef5ca-ef05-4fe8-8b3f-222eda2a2e92",
 CellID->1561506821],
Cell[23149, 625, 150, 2, 70, "ExampleText",ExpressionUUID->"718a7679-d851-4ec8-a65d-bc132732782e"],
Cell[CellGroupData[{
Cell[23324, 631, 228, 4, 70, "Input",ExpressionUUID->"b55ba68e-ce54-4f53-9953-e871ab659992"],
Cell[23555, 637, 647, 13, 70, "Output",ExpressionUUID->"79c44fae-bc63-4fff-beac-8425ede06731"]
}, Open  ]],
Cell[24217, 653, 186, 6, 70, "ExampleText",ExpressionUUID->"c3749a68-99f7-4871-aa2b-11d9fade8177"],
Cell[CellGroupData[{
Cell[24428, 663, 222, 4, 70, "Input",ExpressionUUID->"1dd9d5cf-85d0-4648-a812-97af2a2214de"],
Cell[24653, 669, 435, 11, 70, "Output",ExpressionUUID->"9182e9fc-a9a5-4dba-8109-a1221f6bd9af"]
}, Open  ]],
Cell[25103, 683, 170, 3, 70, "ExampleText",ExpressionUUID->"83dc52c6-0511-4ca4-96ce-8f451b164e98"],
Cell[CellGroupData[{
Cell[25298, 690, 1326, 31, 70, "Input",ExpressionUUID->"ceb83544-b96c-4d65-b0b6-c6f982f8f95c"],
Cell[26627, 723, 138, 1, 70, "Output",ExpressionUUID->"1492dcdc-1125-4bcf-af1e-e74d7e1c0b72"]
}, Open  ]],
Cell[26780, 727, 153, 2, 70, "ExampleText",ExpressionUUID->"18b00d15-683b-405e-bbcd-d6b037e37169"],
Cell[CellGroupData[{
Cell[26958, 733, 417, 8, 70, "Input",ExpressionUUID->"f08d276e-3edc-48bb-8a5c-0199f1c9aae2"],
Cell[27378, 743, 113, 1, 70, "Output",ExpressionUUID->"4382f2fc-97f3-4755-a455-0f7b09d7306e"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[27540, 750, 1237, 31, 70, "ExampleSection",ExpressionUUID->"cff94819-2fad-4af9-89d2-dde8b094f5de",
 CellID->1305812373],
Cell[28780, 783, 674, 17, 70, "ExampleText",ExpressionUUID->"631fd5c8-cd33-46f5-806f-9d48f7199c2b"],
Cell[29457, 802, 923, 23, 70, "ExampleText",ExpressionUUID->"239129bc-95bd-44b5-9e92-d89c5b9e3edb"],
Cell[CellGroupData[{
Cell[30405, 829, 369, 7, 70, "Input",ExpressionUUID->"cb6d6bf9-183e-457f-a4ff-4b8f2708c57f"],
Cell[30777, 838, 113, 1, 70, "Output",ExpressionUUID->"32a695dd-5167-44c8-a77b-e35422743001"]
}, Open  ]],
Cell[30905, 842, 763, 21, 70, "ExampleText",ExpressionUUID->"7904e583-4cde-4991-87ab-96e6d19ccea0"],
Cell[CellGroupData[{
Cell[31693, 867, 305, 6, 70, "Input",ExpressionUUID->"496a5f83-ce96-4dc7-93b3-596f9bb02f32"],
Cell[32001, 875, 111, 1, 70, "Output",ExpressionUUID->"25078f6f-9231-4d01-a7b2-fada76862f68"]
}, Open  ]],
Cell[32127, 879, 821, 27, 70, "ExampleText",ExpressionUUID->"8e694853-ddf7-44c5-9598-1fef6d0dd015"],
Cell[32951, 908, 514, 11, 70, "ExampleText",ExpressionUUID->"a6a61453-f16d-4d11-9f6b-5c315adcc185"]
}, Closed]]
}, Open  ]],
Cell[33492, 923, 2868, 77, 70, "SeeAlsoSection",ExpressionUUID->"3848b23f-77de-449f-bd19-321949f45d89"],
Cell[36363, 1002, 740, 19, 70, "MoreAboutSection",ExpressionUUID->"f1134478-f9ab-4277-ba49-cf5fd23a5c89"],
Cell[37106, 1023, 78, 0, 70, "FooterCell",ExpressionUUID->"d0015283-a18e-4a10-a4c2-ae02f3271236"]
}
]
*)

(* End of internal cache information *)

