(* 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[     51384,       1347]
NotebookOptionsPosition[     41771,       1170]
NotebookOutlinePosition[     43846,       1219]
CellTagsIndexPosition[     43768,       1214]
WindowTitle->EmbeddedFileSignatures
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->
           "0e0732b1-fc60-432d-b7c5-e2de3a1d48d7"], 
          TemplateBox[{8},
           "Spacer1"]}]],
         TextAlignment->Center,ExpressionUUID->
         "df5836d3-b353-424b-a15c-589ba93c756a"],
        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->
           "84176bd2-86bf-4fe1-8d12-52be53650278"]
         }],ExpressionUUID->"234441b9-eea4-409c-914b-8e9806340376"],
         StripOnInput->False],{
        StyleBox[
          "\"ImportByteArray\"", "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup["paclet:ref/ImportByteArray"], Delimiter, 
         StyleBox[
          "\"Functions\"", "SeeAlsoSection", FontSize -> 14, FontSlant -> 
           "Italic", StripOnInput -> False] :> 
         NotebookFind[EvaluationNotebook[], "SeeAlsoSection", All, CellStyle],
          StyleBox[
          StyleBox[
           "\"ImageAppendedData\"", "SeeAlsoRelated", StripOnInput -> False], 
           "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/ImageAppendedData"], 
         StyleBox[
          StyleBox[
           "\"ImageContainerChunks\"", "SeeAlsoRelated", StripOnInput -> 
            False], "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/ImageContainerChunks"], 
         StyleBox[
          StyleBox[
           "\"ByteArrayStrings\"", "SeeAlsoRelated", StripOnInput -> False], 
           "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/ByteArrayStrings"], 
         StyleBox[
          StyleBox[
           "\"SteganographySurvey\"", "SeeAlsoRelated", StripOnInput -> 
            False], "SeeAlsoRelated", StripOnInput -> False] :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/ref/SteganographySurvey"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"SeeAlso"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "448f8135-3d7c-4a57-a6a2-6e6c6f52a99d"],
     "\[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->
           "234d6d41-bbf5-46ed-b7ce-76952d6d9fe8"]
         }],ExpressionUUID->"192113d4-ec7b-4be0-9d19-8c4b93f61925"],
         StripOnInput->False],{
        "\"Steganography\"" :> 
         Documentation`HelpLookup[
          "paclet:WolframInstitute/Puzzles/guide/Steganography"]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"MoreAbout"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "c5a791ab-ad46-4203-b4eb-d8636f2092fc"],
     "\[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->
           "f1e31dd4-58e9-4140-a8b0-8d9aedb422ed"]
         }],ExpressionUUID->"2ebd6ed7-a949-477b-a102-89c01f6c8929"],
         StripOnInput->False],{
        "\"WolframInstitute/Puzzles/ref/EmbeddedFileSignatures\"" :> None, 
         "\"Copy Wolfram Documentation Center URL\"" :> 
         CopyToClipboard[
          "WolframInstitute/Puzzles/ref/EmbeddedFileSignatures"], 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/EmbeddedFileSignatures.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/EmbeddedFileSignatures" <> 
               ".html"], None}]}]},
        Appearance->None,
        MenuAppearance->Automatic,
        MenuStyle->"URLMenu"],
       MouseAppearanceTag["LinkHand"]]],
      LineSpacing->{1.4, 0},ExpressionUUID->
      "c6f54fed-4f7e-4daf-9be7-db5cb01fef26"]
    }], "AnchorBar",
     CacheGraphics->False,ExpressionUUID->
     "cfc1d79a-ccd6-4599-b338-be993de9acef"]}
  }]], "AnchorBarGrid",
 CellID->1,ExpressionUUID->"7d63be38-29eb-41ed-aa5e-98e031b23042"],

Cell["WolframInstitute`Puzzles`", "ContextNameCell",ExpressionUUID->"b16c3591-d979-4f2f-8174-e1ff1aaa1b53"],

Cell[CellGroupData[{

Cell[BoxData[GridBox[{
   {Cell[TextData[{
     Cell[
     "EmbeddedFileSignatures", "ObjectName",ExpressionUUID->
      "f6e8890e-57b5-4cfc-befd-7cefc37a1fd3"],
     Cell[BoxData[
      TemplateBox[{8},
       "Spacer1"]],ExpressionUUID->"d2012e08-29af-42e0-a901-2bc4f9dc7f64"],
     Cell[BoxData[
     ""], "ObjectNameTranslation",ExpressionUUID->
      "90aafa9c-bfc7-4393-a5fc-ed52b8582d1f"]
    }],ExpressionUUID->"867f9c02-db5f-4fa0-8edb-a5395fc1449d"], 
    "\[SpanFromLeft]"}
  }]], "ObjectNameGrid",ExpressionUUID->"82c3913a-ef1d-4f95-aba6-\
90cc8daef2f8"],

Cell[BoxData[GridBox[{
   {"", Cell[TextData[{
     Cell[BoxData[
      RowBox[{
       TemplateBox[{
         Cell[
          TextData["EmbeddedFileSignatures"]], 
         "paclet:WolframInstitute/Puzzles/ref/EmbeddedFileSignatures", 
         "WolframInstitute/Puzzles Package Symbol"},
        "PackageLink",
        BaseStyle->"InlineFormula"], "[", 
       StyleBox["source", "TI"], "]"}]], "InlineFormula",
      FontFamily->"Source Sans Pro",
      FontSize->0.9 Inherited,ExpressionUUID->
      "2bac25a2-71a9-473c-9179-ca481e3cd015"],
     "\[LineSeparator]",
     "gives the positions of known file-format magic numbers inside ",
     StyleBox["source", "TI"],
     ", as a list of Associations ordered by position."
    }],ExpressionUUID->"5f439030-e8e7-47a5-a438-bdc081a2c9d5"]}
  }]], "Usage",ExpressionUUID->"ff676a33-0ec3-4e79-9811-ba85cab98662"]
}, 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->"aa717801-3628-44b1-b3d1-5a7e10296d79"],
  Cell[BoxData[
   TemplateBox[{1},
    "Spacer1"]],ExpressionUUID->"62434ee7-4c75-4cce-8d99-8defc0106e60"],
  "Details and Options"
 }], "NotesFrameText",ExpressionUUID->
  "e4825496-95b3-4cc4-b6d3-aee579d1643d"]],ExpressionUUID->"31fb82b2-c267-\
4994-a696-fab1201b3f83"]], "NotesSection",
 ShowGroupOpener->"Thumbnail",
 WholeCellGroupOpener->True,
 CellGroupingRules->{"SectionGrouping", 50},
 CacheGraphics->False,
 CellID->1232398193,ExpressionUUID->"7bb6ffff-10de-4f98-bc49-235a9f89951a"],

Cell[TextData[{
 StyleBox["source", "TI"],
 " is a ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["File"]], "paclet:ref/File"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "9661193c-0e7e-4593-b880-e9aadec05114"],
 ", a file path, or a ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["ByteArray"]], "paclet:ref/ByteArray"},
   "RefLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",ExpressionUUID->
  "db940255-9050-4dbe-a63e-6cfc49d72b72"],
 "."
}], "Notes",ExpressionUUID->"30e07a20-95d5-488f-89a5-a9e336b3b348"],

Cell[TextData[{
 "Each match records the ",
 Cell[BoxData["\<\"Format\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "5a9667af-87fe-4438-b64b-2c5343fe8351"],
 ", the 0-based ",
 Cell[BoxData["\<\"Position\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "2e7e7da6-3474-40fc-b7bc-ad9a903ef0fd"],
 ", the ",
 Cell[BoxData["\<\"Signature\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "6c402be7-05f3-43d6-b4d9-a8d9f062c093"],
 " bytes matched, and ",
 Cell[BoxData["\<\"ExpectedByChance\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "3276520a-4d39-4ed9-bb2f-6d3e724a6d5b"],
 "."
}], "Notes",ExpressionUUID->"ef975e5b-ae87-49be-9a1b-fb85b81f2e69"],

Cell[TextData[{
 Cell[BoxData["\<\"ExpectedByChance\"\>"], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "a89ded5b-b1a8-41df-b7a0-f6c21ac3412e"],
 " is how many matches of that signature a uniformly random file of the same \
length would carry on average, which is the source length divided by 256 \
raised to the signature's length. It is the number that says whether a match \
means anything."
}], "Notes",ExpressionUUID->"a9be6ce4-6eb2-49ea-a2db-17bd8d192baf"],

Cell["\<\
The signatures recognised are PNG, JPEG, GIF87a, GIF89a, ZIP, an empty ZIP \
archive, GZIP, BZIP2, XZ, RAR, 7-Zip, PDF, ELF, little- and big-endian TIFF, \
RIFF, Ogg, FLAC, ID3 and MS Cabinet.\
\>", "Notes",ExpressionUUID->"608b1a47-d681-4e28-b320-7663b05eceda"],

Cell["\<\
Only signatures of three bytes or more are recognised. A two-byte magic \
number matches random data about once every 65 kilobytes, so including one \
would bury every real match.\
\>", "Notes",ExpressionUUID->"7e50dfa7-e745-4af3-963f-e04fbe1a7929"],

Cell["\<\
A match at position 0 is the source's own format. A match anywhere else is a \
lead, not a conclusion: a nested format may be there for a legitimate reason, \
since an Exif payload is a TIFF stream and a colour profile can be anything.\
\>", "Notes",ExpressionUUID->"c7b63f86-41a2-47ef-a532-3a2e76d24e9e"],

Cell["\<\
A first argument that is not a source matches no definition and is returned \
unevaluated.\
\>", "Notes",ExpressionUUID->"557bfde9-8908-4016-99bb-045b73e00035"]
}, Closed]],

Cell["", "PageDelimiter",ExpressionUUID->"1a50e608-8e99-450d-9b3d-bfc1370e95b2"],

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->"c1914e73-91d1-47f6-a328-ed41c64b19d9"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"2c3af1ce-2586-43b9-9d04-5eae16753d48"],
 "Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(12)", "ExampleCount",ExpressionUUID->
  "23c97d35-8080-4286-afea-bd19661df6e9"]
}], "PrimaryExamplesSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->436654436,ExpressionUUID->"9394ec9e-0711-48d7-a2b4-7c6b37161279"],

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<WolframInstitute`Puzzles`\>\"", "]"}]], "Input", \
"ExampleInitialization",
 CellLabel->"In[1]:=",
 CellID->1969679695,ExpressionUUID->"6a90cd12-eceb-469d-8edd-bee1f91b982b"],

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->
  "92b23ce0-91ee-4714-a6bb-ab7cac5d87f3"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"2239ab17-f166-4d2d-a279-49c70445dfc9"],
 "Basic Examples",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "0b2c8d1a-24e7-411b-8a62-81d8b65ac903"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->899484053,ExpressionUUID->"80280036-3e52-4acb-adb6-2f50c9b52014"],

Cell["Three published magic numbers planted at known offsets:", "ExampleText",
 CellTags->
  "TextAnnotation",ExpressionUUID->"7fd957e3-a376-4256-84d1-bd1aa885b211"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Lookup", "[", 
  RowBox[{
   RowBox[{"EmbeddedFileSignatures", "[", 
    RowBox[{"ByteArray", "[", 
     RowBox[{"Join", "[", 
      RowBox[{
       RowBox[{"ConstantArray", "[", 
        RowBox[{"0", ",", " ", "10"}], "]"}], ",", " ", 
       RowBox[{"{", 
        RowBox[{"80", ",", " ", "75", ",", " ", "3", ",", " ", "4"}], "}"}], ",",
        " ", 
       RowBox[{"ConstantArray", "[", 
        RowBox[{"0", ",", " ", "6"}], "]"}], ",", " ", 
       RowBox[{"ToCharacterCode", "[", "\"\<%PDF-1.7\>\"", "]"}]}], "]"}], 
     "]"}], "]"}], ",", " ", "\"\<Format\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"04200509-c219-4a91-ace9-a05a3bd8428f"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"ZIP\"\>", ",", "\<\"PDF\"\>"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"204a8aba-f5b8-4ef2-8589-939a81c55ad0"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "36e8de44-282b-46e2-9a36-0bf01bcf680d"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"86c30a1f-a11e-41eb-\
8443-91d2d12d6eee"],

Cell["Each one with the offset it sits at:", "ExampleText",ExpressionUUID->"47a391e4-3f9f-43a0-ac6a-04d0ef068e99"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Map", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"Lookup", "[", 
     RowBox[{"#", ",", " ", 
      RowBox[{"{", 
       RowBox[{"\"\<Format\>\"", ",", " ", "\"\<Position\>\""}], "}"}]}], 
     "]"}], " ", "&"}], ",", " ", 
   RowBox[{"EmbeddedFileSignatures", "[", 
    RowBox[{"ByteArray", "[", 
     RowBox[{"Join", "[", 
      RowBox[{
       RowBox[{"ConstantArray", "[", 
        RowBox[{"0", ",", " ", "10"}], "]"}], ",", " ", 
       RowBox[{"{", 
        RowBox[{"80", ",", " ", "75", ",", " ", "3", ",", " ", "4"}], "}"}], ",",
        " ", 
       RowBox[{"ConstantArray", "[", 
        RowBox[{"0", ",", " ", "6"}], "]"}], ",", " ", 
       RowBox[{"ToCharacterCode", "[", "\"\<%PDF-1.7\>\"", "]"}]}], "]"}], 
     "]"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"18d7ce25-abb7-4ca3-80f8-05ab5cef760c"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"\<\"ZIP\"\>", ",", "10"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"\<\"PDF\"\>", ",", "20"}], "}"}]}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"f59e7f55-6c28-42da-97ae-bff1009f527c"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "3293955e-d348-43a3-9194-cd5532d2faf3"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"0dda75fc-46eb-446f-\
be41-ae73fa76c07d"],

Cell["A PNG carries its own signature at position 0:", "ExampleText",ExpressionUUID->"adc7fd8d-0836-4250-8f5b-a6eab5d6d93e"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Lookup", "[", 
  RowBox[{
   RowBox[{"First", "[", 
    RowBox[{"EmbeddedFileSignatures", "[", 
     RowBox[{"ExportByteArray", "[", 
      RowBox[{
       RowBox[{"Image", "[", 
        RowBox[{
         RowBox[{"Table", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{"i", ",", " ", "j", ",", " ", "128"}], "}"}], ",", " ", 
           RowBox[{"{", 
            RowBox[{"i", ",", " ", "16"}], "}"}], ",", " ", 
           RowBox[{"{", 
            RowBox[{"j", ",", " ", "16"}], "}"}]}], "]"}], ",", 
         " ", "\"\<Byte\>\""}], "]"}], ",", " ", "\"\<PNG\>\""}], "]"}], 
     "]"}], "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"\"\<Format\>\"", ",", " ", "\"\<Position\>\""}], "}"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"1b76eec7-c80c-429a-bb73-ce7b43229739"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"PNG\"\>", ",", "0"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"f933b750-4bc6-4766-8743-00bbd9bbabc4"]
}, 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->
  "811a464b-958d-4a0d-ac0e-b3956002ddd6"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"b5abb36b-60e7-45a0-810c-0a7ca4a5a62d"],
 "Scope",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(3)", "ExampleCount",ExpressionUUID->
  "48de3ce2-0be5-491e-a641-6559db14bde9"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1293636265,ExpressionUUID->"76dabd99-5d46-4454-ae37-597e78f68aee"],

Cell["\<\
A whole file hidden on the end of a carrier is found where it starts:\
\>", "ExampleText",ExpressionUUID->"3b2e889c-5f15-4b6b-92d0-27951ab23212"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Map", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"Lookup", "[", 
     RowBox[{"#", ",", " ", 
      RowBox[{"{", 
       RowBox[{"\"\<Format\>\"", ",", " ", "\"\<Position\>\""}], "}"}]}], 
     "]"}], " ", "&"}], ",", " ", 
   RowBox[{"EmbeddedFileSignatures", "[", 
    RowBox[{"ByteArray", "[", 
     RowBox[{"Join", "[", 
      RowBox[{
       RowBox[{"Normal", "[", 
        RowBox[{"ExportByteArray", "[", 
         RowBox[{
          RowBox[{"Image", "[", 
           RowBox[{
            RowBox[{"Table", "[", 
             RowBox[{
              RowBox[{"{", 
               RowBox[{"i", ",", " ", "j", ",", " ", "128"}], "}"}], ",", " ", 
              RowBox[{"{", 
               RowBox[{"i", ",", " ", "16"}], "}"}], ",", " ", 
              RowBox[{"{", 
               RowBox[{"j", ",", " ", "16"}], "}"}]}], "]"}], ",", 
            " ", "\"\<Byte\>\""}], "]"}], ",", " ", "\"\<PNG\>\""}], "]"}], 
        "]"}], ",", " ", 
       RowBox[{
       "ToCharacterCode", "[", "\"\<PK\.03\.04 a hidden archive\>\"", "]"}]}],
       "]"}], "]"}], "]"}]}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"c94b1c4e-47c7-4b2a-ba49-c72b971dfd3f"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"\<\"PNG\"\>", ",", "0"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"\<\"TIFFLittleEndian\"\>", ",", "41"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"\<\"ZIP\"\>", ",", "438"}], "}"}]}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"7700551c-806e-480b-b766-04096541808e"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "09780599-0f74-4f54-b9d2-4f83487f4ac7"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"b775f27b-6ba4-4302-\
8c93-77f029dc8101"],

Cell["The signature bytes themselves come back with each match:", \
"ExampleText",ExpressionUUID->"61d10f06-a47f-40aa-a44d-8ac9f40cdc77"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Normal", "[", 
  RowBox[{"Lookup", "[", 
   RowBox[{
    RowBox[{"First", "[", 
     RowBox[{"EmbeddedFileSignatures", "[", 
      RowBox[{"ByteArray", "[", 
       RowBox[{"Join", "[", 
        RowBox[{
         RowBox[{"ConstantArray", "[", 
          RowBox[{"0", ",", " ", "4"}], "]"}], ",", " ", 
         RowBox[{"ToCharacterCode", "[", "\"\<%PDF-\>\"", "]"}]}], "]"}], 
       "]"}], "]"}], "]"}], ",", " ", "\"\<Signature\>\""}], "]"}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"4066ca85-e4e0-4fc9-9a22-4aa76f3ce61f"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"37", ",", "80", ",", "68", ",", "70", ",", "45"}], "}"}]], "Output",\

 CellLabel->"Out[1]= ",ExpressionUUID->"fc8d776a-22bc-475e-bc79-65d23bb40feb"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "20106961-e798-421c-8e04-d28895928027"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"df14029a-5179-4b92-\
8341-3ac236a7d261"],

Cell["Nothing recognised gives an empty list:", "ExampleText",ExpressionUUID->"c6c2f438-76bd-4a48-9b45-869ed47c6e71"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"EmbeddedFileSignatures", "[", 
  RowBox[{"ByteArray", "[", 
   RowBox[{"ConstantArray", "[", 
    RowBox[{"0", ",", " ", "200"}], "]"}], "]"}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"db17d12d-1c4e-45f2-8e2f-2cf8dc698b5d"],

Cell[BoxData[
 RowBox[{"{", "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"4add55a7-4b2b-479b-9a78-d59797d8c808"]
}, 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->
  "91945f7d-a765-4ccc-a8e0-7689c3d085a5"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"b6775848-c03d-440d-bebf-6bac2951134d"],
 "Applications",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "ac34294a-419e-4320-aa4f-17499f922814"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->258228157,ExpressionUUID->"17db2cfe-d619-4e0d-8dd4-666e2351552b"],

Cell["\<\
The chance expectation weighs each hit. A four-byte signature in a small file \
is far below one, so it is not an accident:\
\>", "ExampleText",ExpressionUUID->"3b437a05-fa50-4f93-ab12-756c7c129208"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Lookup", "[", 
  RowBox[{
   RowBox[{"First", "[", 
    RowBox[{"EmbeddedFileSignatures", "[", 
     RowBox[{"ByteArray", "[", 
      RowBox[{"Join", "[", 
       RowBox[{
        RowBox[{"ConstantArray", "[", 
         RowBox[{"0", ",", " ", "10"}], "]"}], ",", " ", 
        RowBox[{"{", 
         RowBox[{"80", ",", " ", "75", ",", " ", "3", ",", " ", "4"}], 
         "}"}]}], "]"}], "]"}], "]"}], "]"}], ",", 
   " ", "\"\<ExpectedByChance\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"c0cc942b-e895-44a0-b4ce-26c53f2d49ff"],

Cell[BoxData["2.561137080192566`*^-9"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"578aae04-a66a-45e0-a402-87a5495ab6ad"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "0e2ed012-cb32-46d0-825d-3c862f66887c"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"84f2be84-7377-449b-\
8cf0-2192590ccd68"],

Cell["\<\
The same signature in a gigabyte of random data would turn up about a quarter \
of the time, so a hit there says much less:\
\>", "ExampleText",ExpressionUUID->"377df9e8-dcea-4ef1-8914-2bf0b0cd80ea"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"2", "^", "30"}], " ", "/", " ", 
   RowBox[{"256", "^", "4"}]}], " ", "//", " ", "N"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"09676225-97de-4472-b300-f44303f54a86"],

Cell[BoxData["0.25`"], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"e9a44a73-c94d-402c-bb8b-1d7e69262cfb"]
}, 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->
  "f6cddd49-c2a3-4483-a05b-7c934b43f062"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"e76c59c1-88d6-4c81-bdcf-2ada3e7e15ff"],
 "Properties & Relations",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "4bce502b-4ec6-44b8-87e3-83e4588a608e"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->2123667759,ExpressionUUID->"16bd543d-506d-4729-8351-6e6451235ce2"],

Cell[TextData[{
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["SteganographySurvey"]], 
    "paclet:WolframInstitute/Puzzles/ref/SteganographySurvey", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "c2624d72-f9e7-490e-a87a-55aeecd23834"],
 " takes these matches, drops the one at position 0, works out which \
container unit each one landed in, and downgrades a hit that unit explains:"
}], "ExampleText",ExpressionUUID->"d0b90b16-cfed-49ab-8f90-06e97282d521"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Lookup", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"First", "[", 
     RowBox[{"Cases", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"SteganographySurvey", "[", 
         RowBox[{"ByteArray", "[", 
          RowBox[{"Join", "[", 
           RowBox[{
            RowBox[{"Normal", "[", 
             RowBox[{"ExportByteArray", "[", 
              RowBox[{
               RowBox[{"Image", "[", 
                RowBox[{
                 RowBox[{"Table", "[", 
                  RowBox[{
                   RowBox[{"{", 
                    RowBox[{"i", ",", " ", "j", ",", " ", "128"}], "}"}], ",",
                    " ", 
                   RowBox[{"{", 
                    RowBox[{"i", ",", " ", "16"}], "}"}], ",", " ", 
                   RowBox[{"{", 
                    RowBox[{"j", ",", " ", "16"}], "}"}]}], "]"}], ",", 
                 " ", "\"\<Byte\>\""}], "]"}], ",", " ", "\"\<PNG\>\""}], 
              "]"}], "]"}], ",", " ", 
            RowBox[{
            "ToCharacterCode", "[", "\"\<PK\.03\.04 a hidden archive\>\"", 
             "]"}]}], "]"}], "]"}], "]"}], "[", "\"\<Findings\>\"", "]"}], ",",
        " ", 
       RowBox[{"KeyValuePattern", "[", 
        RowBox[{"\"\<Test\>\"", " ", "->", 
         " ", "\"\<EmbeddedFileSignature\>\""}], "]"}]}], "]"}], "]"}], 
    "[", "\"\<Detail\>\"", "]"}], ",", " ", 
   RowBox[{"{", 
    RowBox[{"\"\<Format\>\"", ",", " ", "\"\<Unit\>\""}], "}"}]}], 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"593477ba-430f-4858-b59b-8021aac63c71"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"ZIP\"\>", ",", "\<\"AppendedData\"\>"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"366f7300-bd06-4303-9c53-2520d0173945"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "fd64e109-a9cf-41d4-8083-89afe3773178"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"19a535a5-ee0a-4d7c-\
b116-940c7e5a9fd9"],

Cell[TextData[{
 "A signature in the appended region and ",
 Cell[BoxData[
  TemplateBox[{
    Cell[
     TextData["ImageAppendedData"]], 
    "paclet:WolframInstitute/Puzzles/ref/ImageAppendedData", 
    "WolframInstitute/Puzzles Package Symbol"},
   "PackageLink",
   BaseStyle->"InlineFormula"]], "InlineFormula",
  FontFamily->"Source Sans Pro",
  FontSize->0.9 Inherited,ExpressionUUID->
  "5833eebe-3429-4b83-918a-856301b965d4"],
 " answer the same question from opposite ends:"
}], "ExampleText",ExpressionUUID->"7d9f9cad-d7c2-415f-8c38-bf4019547af6"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Normal", "[", 
  RowBox[{"Take", "[", 
   RowBox[{
    RowBox[{"ImageAppendedData", "[", 
     RowBox[{"ByteArray", "[", 
      RowBox[{"Join", "[", 
       RowBox[{
        RowBox[{"Normal", "[", 
         RowBox[{"ExportByteArray", "[", 
          RowBox[{
           RowBox[{"Image", "[", 
            RowBox[{
             RowBox[{"Table", "[", 
              RowBox[{
               RowBox[{"{", 
                RowBox[{"i", ",", " ", "j", ",", " ", "128"}], "}"}], ",", 
               " ", 
               RowBox[{"{", 
                RowBox[{"i", ",", " ", "16"}], "}"}], ",", " ", 
               RowBox[{"{", 
                RowBox[{"j", ",", " ", "16"}], "}"}]}], "]"}], ",", 
             " ", "\"\<Byte\>\""}], "]"}], ",", " ", "\"\<PNG\>\""}], "]"}], 
         "]"}], ",", " ", 
        RowBox[{
        "ToCharacterCode", "[", "\"\<PK\.03\.04 a hidden archive\>\"", 
         "]"}]}], "]"}], "]"}], "]"}], ",", " ", "4"}], "]"}], "]"}]], "Input",\

 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"d291f83d-fd93-4077-8ed4-7a61bd2c74e5"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"80", ",", "75", ",", "3", ",", "4"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"7795499a-301a-4220-8cb6-598916a87b8d"]
}, 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->
  "2b2a9076-556d-43d0-86b9-689504bb9a56"],
 Cell[BoxData[
  TemplateBox[{1},
   "Spacer1"]],ExpressionUUID->"df652d3f-3caa-4328-8885-8863522ace2d"],
 "Possible Issues",
 "\[NonBreakingSpace]\[NonBreakingSpace]",
 Cell["(2)", "ExampleCount",ExpressionUUID->
  "e8616c65-2549-442a-9ce7-90591c1471a0"]
}], "ExampleSection", "ExampleSection",
 WholeCellGroupOpener->True,
 CacheGraphics->False,
 CellID->1305812373,ExpressionUUID->"219cae7c-b236-4986-8a56-cddbced8cb10"],

Cell["\<\
Every camera JPEG and most PNGs contain a TIFF signature, because that is how \
an Exif block starts. A raw match list says so and it is not a finding:\
\>", "ExampleText",ExpressionUUID->"ae62dbc1-5b3d-4e3b-8b42-af6abf739be7"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Lookup", "[", 
  RowBox[{
   RowBox[{"EmbeddedFileSignatures", "[", 
    RowBox[{"ExportByteArray", "[", 
     RowBox[{
      RowBox[{"Image", "[", 
       RowBox[{
        RowBox[{"Table", "[", 
         RowBox[{
          RowBox[{"{", 
           RowBox[{"i", ",", " ", "j", ",", " ", "128"}], "}"}], ",", " ", 
          RowBox[{"{", 
           RowBox[{"i", ",", " ", "16"}], "}"}], ",", " ", 
          RowBox[{"{", 
           RowBox[{"j", ",", " ", "16"}], "}"}]}], "]"}], ",", 
        " ", "\"\<Byte\>\""}], "]"}], ",", " ", "\"\<PNG\>\""}], "]"}], "]"}],
    ",", " ", "\"\<Format\>\""}], "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"85f08858-9e9a-4f0b-baa4-e45154861cae"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"PNG\"\>", ",", "\<\"TIFFLittleEndian\"\>"}], "}"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"e6924191-96ac-4ee5-b84d-3060dd5752e7"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 InterpretationBox[Cell[
  "\t", "ExampleDelimiter",ExpressionUUID->
   "3ca6c898-daa0-4326-b953-633ed1ceaba2"],
  $Line = 0; Null]], "ExampleDelimiter",ExpressionUUID->"7c970774-e9bd-4b0a-\
b59f-a8514c651d89"],

Cell["\<\
A file path that does not exist matches no definition and is returned \
unevaluated:\
\>", "ExampleText",ExpressionUUID->"a787db0b-3b9a-4e44-b708-d7dea1881244"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"EmbeddedFileSignatures", "[", "\"\</no/such/file/anywhere.png\>\"", 
  "]"}]], "Input",
 CellProlog:>Needs["WolframInstitute`Puzzles`"],
 CellLabel->"In[1]:=",ExpressionUUID->"09d222bd-4ab7-4420-8012-8db5e0608f7c"],

Cell[BoxData[
 RowBox[{"EmbeddedFileSignatures", "[", "\<\"/no/such/file/anywhere.png\"\>", 
  "]"}]], "Output",
 CellLabel->"Out[1]= ",ExpressionUUID->"ec293fec-cee2-4eba-8792-0107bf6bf11e"]
}, 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["ImageAppendedData"]], 
           "paclet:WolframInstitute/Puzzles/ref/ImageAppendedData", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "fc964f49-40e9-43f3-bfc1-e13ce48e0c01"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["ImageContainerChunks"]], 
           "paclet:WolframInstitute/Puzzles/ref/ImageContainerChunks", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "4b8503d5-bde1-438d-82b4-7b32030977ad"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["ByteArrayStrings"]], 
           "paclet:WolframInstitute/Puzzles/ref/ByteArrayStrings", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "ef1ec1ca-19d6-4872-aeb4-27cfbd6cfd99"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["SteganographySurvey"]], 
           "paclet:WolframInstitute/Puzzles/ref/SteganographySurvey", 
           "WolframInstitute/Puzzles Package Symbol"},
          "PackageLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "d3f61699-376c-44e0-934f-38f88fbff215"],
        "\[NonBreakingSpace]",
        StyleBox[
        "\[MediumSpace]\[FilledVerySmallSquare]\[MediumSpace]", 
         "InlineSeparator"],
        " ",
        Cell[BoxData[
         TemplateBox[{
           Cell[
            TextData["ImportByteArray"]], "paclet:ref/ImportByteArray"},
          "RefLink",
          BaseStyle->"InlineFormula"]], "InlineFormula",
         FontFamily->"Source Sans Pro",ExpressionUUID->
         "67e5b0a2-8dfa-4c51-873c-f88aea29863f"]
       }], "SeeAlso",ExpressionUUID->"1f05c101-4eda-46d7-b2f3-7fdf73dd3235"]}
     }]}
  }]], "SeeAlsoSection",ExpressionUUID->"874290ec-079a-413b-8209-\
969bec09ccbb"],

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["Steganography"]], 
           "paclet:WolframInstitute/Puzzles/guide/Steganography"},
          "RefLinkPlain",
          BaseStyle->{"MoreAbout"}]], "MoreAbout",ExpressionUUID->
         "aec3b823-9e9b-4e92-9db6-2bc04ab8ed84"]}]}
     }]}
  }]], "MoreAboutSection",ExpressionUUID->"fbb4f845-834e-42a5-b2df-\
17bd42528df6"],

Cell[" ", "FooterCell",ExpressionUUID->"fed37bd4-68cc-47fc-8b18-34cfca90eb5b"]
},
Saveable->False,
ScreenStyleEnvironment->"Working",
WindowSize->{900, 830},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
WindowTitle->"EmbeddedFileSignatures",
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, 33.277224}", 
    "history" -> {"XX", "", "", ""}, "context" -> "WolframInstitute`Puzzles`",
     "keywords" -> {}, "specialkeywords" -> {}, 
    "tutorialcollectionlinks" -> {}, "index" -> True, "label" -> 
    "Wolfram Institute/ Puzzles Symbol", "language" -> "en", "paclet" -> 
    "WolframInstitute/Puzzles", "status" -> "None", "summary" -> 
    "PackageLink[EmbeddedFileSignatures, paclet : \
WolframInstitute/Puzzles/ref/EmbeddedFileSignatures, WolframInstitute/Puzzles \
Package Symbol][source] gives the positions of known file-format magic \
numbers inside source, as a list of Associations ordered by position.", 
    "synonyms" -> {}, "tabletags" -> {}, "title" -> "EmbeddedFileSignatures", 
    "titlemodifier" -> "", "metadescription" -> "", "windowtitle" -> 
    "EmbeddedFileSignatures", "type" -> "Symbol", "uri" -> 
    "WolframInstitute/Puzzles/ref/EmbeddedFileSignatures"}},
CellContext->CellGroup,
FrontEndVersion->"15.0 for Mac OS X ARM (64-bit) (May 19, 2026)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "Reference.nb"],
ExpressionUUID->"b861c06c-fefc-452d-93df-4729e93072be"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{
 "TextAnnotation"->{
  Cell[16096, 425, 165, 2, 70, "ExampleText",ExpressionUUID->"7fd957e3-a376-4256-84d1-bd1aa885b211",
   CellTags->"TextAnnotation"]}
 }
*)
(*CellTagsIndex
CellTagsIndex->{
 {"TextAnnotation", 43611, 1208}
 }
*)
(*NotebookFileOutline
Notebook[{
Cell[590, 21, 6403, 155, 70, "AnchorBarGrid",ExpressionUUID->"7d63be38-29eb-41ed-aa5e-98e031b23042",
 CellID->1],
Cell[6996, 178, 107, 0, 70, "ContextNameCell",ExpressionUUID->"b16c3591-d979-4f2f-8174-e1ff1aaa1b53"],
Cell[CellGroupData[{
Cell[7128, 182, 565, 14, 70, "ObjectNameGrid",ExpressionUUID->"82c3913a-ef1d-4f95-aba6-90cc8daef2f8"],
Cell[7696, 198, 862, 20, 70, "Usage",ExpressionUUID->"ff676a33-0ec3-4e79-9811-ba85cab98662"]
}, Open  ]],
Cell[CellGroupData[{
Cell[8595, 223, 1444, 34, 70, "NotesSection",ExpressionUUID->"7bb6ffff-10de-4f98-bc49-235a9f89951a",
 CellGroupingRules->{"SectionGrouping", 50},
 CellID->1232398193],
Cell[10042, 259, 643, 21, 70, "Notes",ExpressionUUID->"30e07a20-95d5-488f-89a5-a9e336b3b348"],
Cell[10688, 282, 862, 22, 70, "Notes",ExpressionUUID->"ef975e5b-ae87-49be-9a1b-fb85b81f2e69"],
Cell[11553, 306, 512, 9, 70, "Notes",ExpressionUUID->"a9be6ce4-6eb2-49ea-a2db-17bd8d192baf"],
Cell[12068, 317, 272, 4, 70, "Notes",ExpressionUUID->"608b1a47-d681-4e28-b320-7663b05eceda"],
Cell[12343, 323, 259, 4, 70, "Notes",ExpressionUUID->"7e50dfa7-e745-4af3-963f-e04fbe1a7929"],
Cell[12605, 329, 315, 4, 70, "Notes",ExpressionUUID->"c7b63f86-41a2-47ef-a532-3a2e76d24e9e"],
Cell[12923, 335, 170, 3, 70, "Notes",ExpressionUUID->"557bfde9-8908-4016-99bb-045b73e00035"]
}, Closed]],
Cell[13108, 341, 80, 0, 70, "PageDelimiter",ExpressionUUID->"1a50e608-8e99-450d-9b3d-bfc1370e95b2"],
Cell[CellGroupData[{
Cell[13213, 345, 1401, 37, 70, "PrimaryExamplesSection",ExpressionUUID->"9394ec9e-0711-48d7-a2b4-7c6b37161279",
 CellID->436654436],
Cell[14617, 384, 216, 4, 70, "Input",ExpressionUUID->"6a90cd12-eceb-469d-8edd-bee1f91b982b",
 CellID->1969679695],
Cell[CellGroupData[{
Cell[14858, 392, 1235, 31, 70, "ExampleSection",ExpressionUUID->"80280036-3e52-4acb-adb6-2f50c9b52014",
 CellID->899484053],
Cell[16096, 425, 165, 2, 70, "ExampleText",ExpressionUUID->"7fd957e3-a376-4256-84d1-bd1aa885b211",
 CellTags->"TextAnnotation"],
Cell[CellGroupData[{
Cell[16286, 431, 740, 17, 70, "Input",ExpressionUUID->"04200509-c219-4a91-ace9-a05a3bd8428f"],
Cell[17029, 450, 172, 3, 70, "Output",ExpressionUUID->"204a8aba-f5b8-4ef2-8589-939a81c55ad0"]
}, Open  ]],
Cell[CellGroupData[{
Cell[17238, 458, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"86c30a1f-a11e-41eb-8443-91d2d12d6eee"],
Cell[17465, 465, 114, 0, 70, "ExampleText",ExpressionUUID->"47a391e4-3f9f-43a0-ac6a-04d0ef068e99"],
Cell[CellGroupData[{
Cell[17604, 469, 908, 23, 70, "Input",ExpressionUUID->"18d7ce25-abb7-4ca3-80f8-05ab5cef760c"],
Cell[18515, 494, 272, 7, 70, "Output",ExpressionUUID->"f59e7f55-6c28-42da-97ae-bff1009f527c"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[18836, 507, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"0dda75fc-46eb-446f-be41-ae73fa76c07d"],
Cell[19063, 514, 124, 0, 70, "ExampleText",ExpressionUUID->"adc7fd8d-0836-4250-8f5b-a6eab5d6d93e"],
Cell[CellGroupData[{
Cell[19212, 518, 887, 23, 70, "Input",ExpressionUUID->"1b76eec7-c80c-429a-bb73-ce7b43229739"],
Cell[20102, 543, 162, 3, 70, "Output",ExpressionUUID->"f933b750-4bc6-4766-8743-00bbd9bbabc4"]
}, Open  ]]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[20325, 553, 1227, 31, 70, "ExampleSection",ExpressionUUID->"76dabd99-5d46-4454-ae37-597e78f68aee",
 CellID->1293636265],
Cell[21555, 586, 155, 2, 70, "ExampleText",ExpressionUUID->"3b2e889c-5f15-4b6b-92d0-27951ab23212"],
Cell[CellGroupData[{
Cell[21735, 592, 1229, 32, 70, "Input",ExpressionUUID->"c94b1c4e-47c7-4b2a-ba49-c72b971dfd3f"],
Cell[22967, 626, 355, 9, 70, "Output",ExpressionUUID->"7700551c-806e-480b-b766-04096541808e"]
}, Open  ]],
Cell[CellGroupData[{
Cell[23359, 640, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"b775f27b-6ba4-4302-8c93-77f029dc8101"],
Cell[23586, 647, 137, 1, 70, "ExampleText",ExpressionUUID->"61d10f06-a47f-40aa-a44d-8ac9f40cdc77"],
Cell[CellGroupData[{
Cell[23748, 652, 615, 15, 70, "Input",ExpressionUUID->"4066ca85-e4e0-4fc9-9a22-4aa76f3ce61f"],
Cell[24366, 669, 189, 4, 70, "Output",ExpressionUUID->"fc8d776a-22bc-475e-bc79-65d23bb40feb"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[24604, 679, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"df14029a-5179-4b92-8341-3ac236a7d261"],
Cell[24831, 686, 117, 0, 70, "ExampleText",ExpressionUUID->"c6c2f438-76bd-4a48-9b45-869ed47c6e71"],
Cell[CellGroupData[{
Cell[24973, 690, 311, 6, 70, "Input",ExpressionUUID->"db17d12d-1c4e-45f2-8e2f-2cf8dc698b5d"],
Cell[25287, 698, 124, 2, 70, "Output",ExpressionUUID->"4add55a7-4b2b-479b-9a78-d59797d8c808"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[25472, 707, 1233, 31, 70, "ExampleSection",ExpressionUUID->"17db2cfe-d619-4e0d-8dd4-666e2351552b",
 CellID->258228157],
Cell[26708, 740, 209, 3, 70, "ExampleText",ExpressionUUID->"3b437a05-fa50-4f93-ab12-756c7c129208"],
Cell[CellGroupData[{
Cell[26942, 747, 620, 15, 70, "Input",ExpressionUUID->"c0cc942b-e895-44a0-b4ce-26c53f2d49ff"],
Cell[27565, 764, 128, 1, 70, "Output",ExpressionUUID->"578aae04-a66a-45e0-a402-87a5495ab6ad"]
}, Open  ]],
Cell[CellGroupData[{
Cell[27730, 770, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"84f2be84-7377-449b-8cf0-2192590ccd68"],
Cell[27957, 777, 209, 3, 70, "ExampleText",ExpressionUUID->"377df9e8-dcea-4ef1-8914-2bf0b0cd80ea"],
Cell[CellGroupData[{
Cell[28191, 784, 271, 6, 70, "Input",ExpressionUUID->"09676225-97de-4472-b300-f44303f54a86"],
Cell[28465, 792, 111, 1, 70, "Output",ExpressionUUID->"e9a44a73-c94d-402c-bb8b-1d7e69262cfb"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[28637, 800, 1244, 31, 70, "ExampleSection",ExpressionUUID->"16bd543d-506d-4729-8351-6e6451235ce2",
 CellID->2123667759],
Cell[29884, 833, 617, 14, 70, "ExampleText",ExpressionUUID->"d0b90b16-cfed-49ab-8f90-06e97282d521"],
Cell[CellGroupData[{
Cell[30526, 851, 1599, 40, 70, "Input",ExpressionUUID->"593477ba-430f-4858-b59b-8021aac63c71"],
Cell[32128, 893, 181, 3, 70, "Output",ExpressionUUID->"366f7300-bd06-4303-9c53-2520d0173945"]
}, Open  ]],
Cell[CellGroupData[{
Cell[32346, 901, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"19a535a5-ee0a-4d7c-b116-940c7e5a9fd9"],
Cell[32573, 908, 558, 14, 70, "ExampleText",ExpressionUUID->"7d9f9cad-d7c2-415f-8c38-bf4019547af6"],
Cell[CellGroupData[{
Cell[33156, 926, 1117, 29, 70, "Input",ExpressionUUID->"d291f83d-fd93-4077-8ed4-7a61bd2c74e5"],
Cell[34276, 957, 174, 3, 70, "Output",ExpressionUUID->"7795499a-301a-4220-8cb6-598916a87b8d"]
}, Open  ]]
}, Open  ]]
}, Closed]],
Cell[CellGroupData[{
Cell[34511, 967, 1237, 31, 70, "ExampleSection",ExpressionUUID->"219cae7c-b236-4986-8a56-cddbced8cb10",
 CellID->1305812373],
Cell[35751, 1000, 237, 3, 70, "ExampleText",ExpressionUUID->"ae62dbc1-5b3d-4e3b-8b42-af6abf739be7"],
Cell[CellGroupData[{
Cell[36013, 1007, 766, 19, 70, "Input",ExpressionUUID->"85f08858-9e9a-4f0b-baa4-e45154861cae"],
Cell[36782, 1028, 185, 3, 70, "Output",ExpressionUUID->"e6924191-96ac-4ee5-b84d-3060dd5752e7"]
}, Open  ]],
Cell[CellGroupData[{
Cell[37004, 1036, 224, 5, 70, "ExampleDelimiter",ExpressionUUID->"7c970774-e9bd-4b0a-b59f-a8514c651d89"],
Cell[37231, 1043, 170, 3, 70, "ExampleText",ExpressionUUID->"a787db0b-3b9a-4e44-b708-d7dea1881244"],
Cell[CellGroupData[{
Cell[37426, 1050, 238, 4, 70, "Input",ExpressionUUID->"09d222bd-4ab7-4420-8012-8db5e0608f7c"],
Cell[37667, 1056, 191, 3, 70, "Output",ExpressionUUID->"ec293fec-cee2-4eba-8792-0107bf6bf11e"]
}, Open  ]]
}, Open  ]]
}, Closed]]
}, Open  ]],
Cell[37909, 1065, 3068, 80, 70, "SeeAlsoSection",ExpressionUUID->"874290ec-079a-413b-8209-969bec09ccbb"],
Cell[40980, 1147, 706, 19, 70, "MoreAboutSection",ExpressionUUID->"fbb4f845-834e-42a5-b2df-17bd42528df6"],
Cell[41689, 1168, 78, 0, 70, "FooterCell",ExpressionUUID->"fed37bd4-68cc-47fc-8b18-34cfca90eb5b"]
}
]
*)

(* End of internal cache information *)

