{
  "schemaVersion": 1,
  "updated": "2026-10-29",
  "recomputeCommand": "node --experimental-strip-types scripts/beaufort-analysis.ts",
  "sources": {
    "beaufort": "https://www.cryptogram.org/downloads/aca.info/ciphers/Beaufort.pdf",
    "variant": "https://www.cryptogram.org/downloads/aca.info/ciphers/Variant.pdf",
    "autokey": "https://www.cryptogram.org/downloads/aca.info/ciphers/Autokey.pdf",
    "vigenere": "https://www.cryptogram.org/downloads/aca.info/ciphers/Vigenere.pdf"
  },
  "worked": {
    "plaintext": "HELLO",
    "keyword": "KEY",
    "expandedKey": "KEYKE",
    "ciphertext": "DANZQ",
    "forward": [
      {
        "position": 1,
        "input": "H",
        "inputValue": 7,
        "key": "K",
        "keyValue": 10,
        "difference": 3,
        "result": 3,
        "output": "D"
      },
      {
        "position": 2,
        "input": "E",
        "inputValue": 4,
        "key": "E",
        "keyValue": 4,
        "difference": 0,
        "result": 0,
        "output": "A"
      },
      {
        "position": 3,
        "input": "L",
        "inputValue": 11,
        "key": "Y",
        "keyValue": 24,
        "difference": 13,
        "result": 13,
        "output": "N"
      },
      {
        "position": 4,
        "input": "L",
        "inputValue": 11,
        "key": "K",
        "keyValue": 10,
        "difference": -1,
        "result": 25,
        "output": "Z"
      },
      {
        "position": 5,
        "input": "O",
        "inputValue": 14,
        "key": "E",
        "keyValue": 4,
        "difference": -10,
        "result": 16,
        "output": "Q"
      }
    ],
    "reverse": [
      {
        "position": 1,
        "input": "D",
        "inputValue": 3,
        "key": "K",
        "keyValue": 10,
        "difference": 7,
        "result": 7,
        "output": "H"
      },
      {
        "position": 2,
        "input": "A",
        "inputValue": 0,
        "key": "E",
        "keyValue": 4,
        "difference": 4,
        "result": 4,
        "output": "E"
      },
      {
        "position": 3,
        "input": "N",
        "inputValue": 13,
        "key": "Y",
        "keyValue": 24,
        "difference": 11,
        "result": 11,
        "output": "L"
      },
      {
        "position": 4,
        "input": "Z",
        "inputValue": 25,
        "key": "K",
        "keyValue": 10,
        "difference": -15,
        "result": 11,
        "output": "L"
      },
      {
        "position": 5,
        "input": "Q",
        "inputValue": 16,
        "key": "E",
        "keyValue": 4,
        "difference": -12,
        "result": 14,
        "output": "O"
      }
    ]
  },
  "comparison": {
    "keyword": "LEMON",
    "corpusSource": "scripts/cipher-identifier-benchmark.ts#CORPUS",
    "corpusDescription": "Twelve traditional public-domain English proverbs, modern spelling; the same fixed corpus used by the cipher identifier.",
    "normalization": "Case, spaces and punctuation retained. Only ASCII letters consume repeated key positions. Each operation starts the key at position zero.",
    "interpretation": "These are algebraic identity checks on a fixed corpus, not an accuracy estimate for unknown-key decoding. Vigenere decryption receives the original sentence as input for the operation comparison.",
    "total": 12,
    "variantMatches": 12,
    "reciprocalMatches": 12,
    "sentences": [
      {
        "id": 1,
        "plaintext": "A stitch in time saves nine.",
        "beaufort": "L mtgujx eb udsi wnqau bfya.",
        "variant": "P ohugrd wz gxis enkag zvca.",
        "vigenere": "L wfwgnl ub gtqq gngie bvyi.",
        "vigenereDecoded": "P ohugrd wz gxis enkag zvca.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "A stitch in time saves nine.",
        "reciprocal": true
      },
      {
        "id": 2,
        "plaintext": "Actions speak louder than words.",
        "beaufort": "Lctgzym uzjlu batiav vglr qawim.",
        "variant": "Pyhubco gbrpg zahsaf fupj kaeso.",
        "vigenere": "Lgfwbyw edrlo xchoid hulr iceow.",
        "vigenereDecoded": "Pyhubco gbrpg zahsaf fupj kaeso.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Actions speak louder than words.",
        "reciprocal": true
      },
      {
        "id": 3,
        "plaintext": "All that glitters is not gold.",
        "beaufort": "Ltb vgll gdfslixv dm zau fqbl.",
        "variant": "Phz fupp uxvipsdf xo bag vkzp.",
        "vigenere": "Lpx hulx szvexqff tw zcg rsxr.",
        "vigenereDecoded": "Phz fupp uxvipsdf xo bag vkzp.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "All that glitters is not gold.",
        "reciprocal": true
      },
      {
        "id": 4,
        "plaintext": "Better late than never.",
        "beaufort": "Katvju tmvj sxmb ahjix.",
        "variant": "Qahfrg hofr idoz atrsd.",
        "vigenere": "Mifhrc pmhr elmb apzqf.",
        "vigenereDecoded": "Qahfrg hofr idoz atrsd.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Better late than never.",
        "reciprocal": true
      },
      {
        "id": 5,
        "plaintext": "Birds of a feather flock together.",
        "beaufort": "Kwvlv xz m jjllfkw gtymd sqgkueav.",
        "variant": "Qefpf db o rrppvqe uhcox ikuqgwaf.",
        "vigenere": "Mmdrf zj m trlxtse qpaqx esssgsid.",
        "vigenereDecoded": "Qefpf db o rrppvqe uhcox ikuqgwaf.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Birds of a feather flock together.",
        "reciprocal": true
      },
      {
        "id": 6,
        "plaintext": "Every cloud has a silver lining.",
        "beaufort": "Hjixp jtyuk eeu o vdtrkw awzgaf.",
        "variant": "Trsdl rhcgq wwg m fxhjqe aebuav.",
        "vigenere": "Pzqfl npaiq see o ftphse wmzwar.",
        "vigenereDecoded": "Trsdl rhcgq wwg m fxhjqe aebuav.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Every cloud has a silver lining.",
        "reciprocal": true
      },
      {
        "id": 7,
        "plaintext": "Fortune favors the bold.",
        "beaufort": "Gqvvtya hosxnu vgh dydk.",
        "variant": "Ukffhca tmidng fut xcxq.",
        "vigenere": "Qsdhhyi roizve hup fazq.",
        "vigenereDecoded": "Ukffhca tmidng fut xcxq.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Fortune favors the bold.",
        "reciprocal": true
      },
      {
        "id": 8,
        "plaintext": "Look before you leap.",
        "beaufort": "Aqye mhzyxj nqs djlp.",
        "variant": "Akcw otbcdr nki xrpl.",
        "vigenere": "Wsay opjafr jsg zrlt.",
        "vigenereDecoded": "Akcw otbcdr nki xrpl.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Look before you leap.",
        "reciprocal": true
      },
      {
        "id": 9,
        "plaintext": "Necessity is the mother of invention.",
        "beaufort": "Yakkvtwtq ft lfk bxlfkw xz ebshrtgzy.",
        "variant": "Caqqfhehk vh pvq zdpvqe db wzitjhubc.",
        "vigenere": "Yiosfdmfm vd xts zzxtse zj ubiprfwby.",
        "vigenereDecoded": "Caqqfhehk vh pvq zdpvqe db wzitjhubc.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Necessity is the mother of invention.",
        "reciprocal": true
      },
      {
        "id": 10,
        "plaintext": "Practice makes perfect.",
        "beaufort": "Wnmmudci cnbau zjuzimu.",
        "variant": "Enoogxys ynzag brgbsog.",
        "vigenere": "Avmqgtgq anvie drcjqqg.",
        "vigenereDecoded": "Enoogxys ynzag brgbsog.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Practice makes perfect.",
        "reciprocal": true
      },
      {
        "id": 11,
        "plaintext": "The early bird catches the worm.",
        "beaufort": "Sxi knuto nfub koujxiw uea qawz.",
        "variant": "Ids qnghm nvgz qmgrdse gwa kaeb.",
        "vigenere": "Elq sncpk pvch oognlqg gsi icex.",
        "vigenereDecoded": "Ids qnghm nvgz qmgrdse gwa kaeb.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "The early bird catches the worm.",
        "reciprocal": true
      },
      {
        "id": 12,
        "plaintext": "Where there is a will, there is a way.",
        "beaufort": "Pxixj sxixj dm m sfat, thjua ew n peo.",
        "variant": "Ldsdr idsdr xo o ivah, htrga we n lwm.",
        "vigenere": "Hlqfr elqfr tw m kvwp, fvrci ug n hek.",
        "vigenereDecoded": "Ldsdr idsdr xo o ivah, htrga we n lwm.",
        "variantEqualsVigenereDecode": true,
        "beaufortTwice": "Where there is a will, there is a way.",
        "reciprocal": true
      }
    ]
  },
  "keyLengthDemo": {
    "title": "Gettysburg Address (Bliss copy, speech body)",
    "source": "https://en.wikisource.org/wiki/Gettysburg_Address_(Bliss_copy)",
    "keyword": "LINCOLN",
    "knownKeyLength": 7,
    "normalization": "Uppercase A–Z only; punctuation and spaces removed before encryption.",
    "plaintext": "FOURSCOREANDSEVENYEARSAGOOURFATHERSBROUGHTFORTHONTHISCONTINENTANEWNATIONCONCEIVEDINLIBERTYANDDEDICATEDTOTHEPROPOSITIONTHATALLMENARECREATEDEQUALNOWWEAREENGAGEDINAGREATCIVILWARTESTINGWHETHERTHATNATIONORANYNATIONSOCONCEIVEDANDSODEDICATEDCANLONGENDUREWEAREMETONAGREATBATTLEFIELDOFTHATWARWEHAVECOMETODEDICATEAPORTIONOFTHATFIELDASAFINALRESTINGPLACEFORTHOSEWHOHEREGAVETHEIRLIVESTHATTHATNATIONMIGHTLIVEITISALTOGETHERFITTINGANDPROPERTHATWESHOULDDOTHISBUTINALARGERSENSEWECANNOTDEDICATEWECANNOTCONSECRATEWECANNOTHALLOWTHISGROUNDTHEBRAVEMENLIVINGANDDEADWHOSTRUGGLEDHEREHAVECONSECRATEDITFARABOVEOURPOORPOWERTOADDORDETRACTTHEWORLDWILLLITTLENOTENORLONGREMEMBERWHATWESAYHEREBUTITCANNEVERFORGETWHATTHEYDIDHEREITISFORUSTHELIVINGRATHERTOBEDEDICATEDHERETOTHEUNFINISHEDWORKWHICHTHEYWHOFOUGHTHEREHAVETHUSFARSONOBLYADVANCEDITISRATHERFORUSTOBEHEREDEDICATEDTOTHEGREATTASKREMAININGBEFOREUSTHATFROMTHESEHONOREDDEADWETAKEINCREASEDDEVOTIONTOTHATCAUSEFORWHICHTHEYGAVETHELASTFULLMEASUREOFDEVOTIONTHATWEHEREHIGHLYRESOLVETHATTHESEDEADSHALLNOTHAVEDIEDINVAINTHATTHISNATIONUNDERGODSHALLHAVEANEWBIRTHOFFREEDOMANDTHATGOVERNMENTOFTHEPEOPLEBYTHEPEOPLEFORTHEPEOPLESHALLNOTPERISHFROMTHEEARTH",
    "ciphertext": "GUTLWJZUENPLTJQEAEKLWTIHOARWGIUVKUVKRZIIEUGUWJHXASBFKMXASAAYBSNYERPOSFXVLOBJJDNJZGYC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BSBJYOUUE",
    "letterCount": 1149,
    "method": "For each candidate length m=1..14, split the ciphertext into m interleaved columns; compute sum(f*(f-1))/(n*(n-1)) in each column and take the unweighted mean. Columns shorter than two letters have IoC zero. Rank by descending raw mean, then ascending length.",
    "candidates": [
      {
        "keyLength": 1,
        "ioc": 0.04460324536106234,
        "displayIoC": "0.0446",
        "columnLengths": [
          1149
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 2,
        "ioc": 0.044631499854720834,
        "displayIoC": "0.0446",
        "columnLengths": [
          575,
          574
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 3,
        "ioc": 0.04414036334805135,
        "displayIoC": "0.0441",
        "columnLengths": [
          383,
          383,
          383
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 4,
        "ioc": 0.04417867870611773,
        "displayIoC": "0.0442",
        "columnLengths": [
          288,
          287,
          287,
          287
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 5,
        "ioc": 0.04457919052425063,
        "displayIoC": "0.0446",
        "columnLengths": [
          230,
          230,
          230,
          230,
          229
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 6,
        "ioc": 0.044928967269832525,
        "displayIoC": "0.0449",
        "columnLengths": [
          192,
          192,
          192,
          191,
          191,
          191
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 7,
        "ioc": 0.07167472160738657,
        "displayIoC": "0.0717",
        "columnLengths": [
          165,
          164,
          164,
          164,
          164,
          164,
          164
        ],
        "knownPeriodMultiple": true
      },
      {
        "keyLength": 8,
        "ioc": 0.0440084416756952,
        "displayIoC": "0.0440",
        "columnLengths": [
          144,
          144,
          144,
          144,
          144,
          143,
          143,
          143
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 9,
        "ioc": 0.04388991306642225,
        "displayIoC": "0.0439",
        "columnLengths": [
          128,
          128,
          128,
          128,
          128,
          128,
          127,
          127,
          127
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 10,
        "ioc": 0.04433959080078033,
        "displayIoC": "0.0443",
        "columnLengths": [
          115,
          115,
          115,
          115,
          115,
          115,
          115,
          115,
          115,
          114
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 11,
        "ioc": 0.044789837993721486,
        "displayIoC": "0.0448",
        "columnLengths": [
          105,
          105,
          105,
          105,
          105,
          104,
          104,
          104,
          104,
          104,
          104
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 12,
        "ioc": 0.04400507029986312,
        "displayIoC": "0.0440",
        "columnLengths": [
          96,
          96,
          96,
          96,
          96,
          96,
          96,
          96,
          96,
          95,
          95,
          95
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 13,
        "ioc": 0.04415741174749311,
        "displayIoC": "0.0442",
        "columnLengths": [
          89,
          89,
          89,
          89,
          89,
          88,
          88,
          88,
          88,
          88,
          88,
          88,
          88
        ],
        "knownPeriodMultiple": false
      },
      {
        "keyLength": 14,
        "ioc": 0.0718400767866925,
        "displayIoC": "0.0718",
        "columnLengths": [
          83,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82,
          82
        ],
        "knownPeriodMultiple": true
      }
    ],
    "ranking": [
      14,
      7,
      6,
      11,
      2,
      1,
      5,
      10,
      4,
      13,
      3,
      8,
      12,
      9
    ],
    "vigenereAtKnownPeriod": 0.07167472160738657,
    "caveat": "Multiples of the true period can also peak. IoC suggests candidate periods, not a proven key. This repeated-key demonstration does not apply directly to plaintext autokey."
  }
}
