restart; with(Maplets[Elements]): inspace := proc(sentence, bl) local i, j, nsent, s; nsent := ""; s := cat(seq(" ", j = 1..bl)); for i from 1 to length(sentence)-1 do nsent := cat(nsent, sentence[i], s); od: nsent := cat(nsent, sentence[length(sentence)]); end: displaypt := proc() local pt, i; global M; pt := ""; for i from 1 to LinearAlgebra:-RowDimension(M) do pt := StringTools:-Trim(cat(pt, op(convert(LinearAlgebra:-Row(M, i), list)))); od: Maplets:-Tools:-Set('PT' = pt); end: swapM := proc(rf, cf, rt, ct, cribc) local temp, res; global M; if rf < 1 or cf < 1 or rt < 1 or ct < 1 or rf > LinearAlgebra:-RowDimension(M) or cf > LinearAlgebra:-ColumnDimension(M) or rt > LinearAlgebra:-RowDimension(M) or ct > LinearAlgebra:-ColumnDimension(M) then Maplets:-Display(acheckn4); res := convert(Maplets:-Tools:-Get('PTRANS'), symbol); else temp := M[rf,cf]; M[rf,cf] := M[rt,ct]; M[rt,ct] := temp; displaypt(); res := displayrowcol(cribc); fi: end: linecol := proc(carray) local colstr, collist, i, j, res, pt; global sctext, q, M; collist := [seq(seq(j, j = [parse(carray)][i]), i = 1..nops([parse(carray)]))]; if min(collist) < 1 or max(collist) > nops(sctext) then Maplets:-Display(acheckn1); res := convert("", symbol); else colstr := []; for i from 1 to nops(collist) do if length(sctext[collist[i]]) < q+1 then colstr := [op(colstr), cat(StringTools:-UpperCase(sctext[collist[i]]), " ")]; else colstr := [op(colstr), cat(StringTools:-UpperCase(sctext[collist[i]]))]; fi: od: M := Matrix(q+1, max(nops(colstr),nops(sctext)), fill = " "); for j from 1 to nops(colstr) do for i from 1 to length(colstr[j]) do M[i,j] := colstr[j][i]; od: od: displaypt(); res := displayrowcol(carray); fi: end: shiftup := proc(udlist, cribc) local ud, A, ncol, i, j, res, pt; global M; ud := [seq(seq(j, j = [parse(udlist)][i]), i = 1..nops([parse(udlist)]))]; if min(ud) < 1 or max(ud) > LinearAlgebra:-ColumnDimension(M) then Maplets:-Display(acheckn2); res := convert(Maplets:-Tools:-Get('PTRANS'), symbol); else ncol := []; for i from 1 to nops(ud) do ncol := [op(ncol), convert(ListTools:-Rotate(convert(LinearAlgebra:-Column(M,ud[i]), list), 1), Vector)]; od: A := []; j := 0; for i from 1 to LinearAlgebra:-ColumnDimension(M) do if ListTools:-Search(i, ud) > 0 then j := j + 1; A := [op(A), ncol[j]]; else A := [op(A), LinearAlgebra:-Column(M, i)]; fi: od: M := Matrix([seq(A[i], i = 1..nops(A))]); displaypt(); res := displayrowcol(cribc); fi: end: shiftdown := proc(udlist, cribc) local ud, A, ncol, i, j, res, pt; global M; ud := [seq(seq(j, j = [parse(udlist)][i]), i = 1..nops([parse(udlist)]))]; if min(ud) < 1 or max(ud) > LinearAlgebra:-ColumnDimension(M) then Maplets:-Display(acheckn2); res := convert(Maplets:-Tools:-Get('PTRANS'), symbol); else ncol := []; for i from 1 to nops(ud) do ncol := [op(ncol), convert(ListTools:-Rotate(convert(LinearAlgebra:-Column(M,ud[i]), list), -1), Vector)]; od: A := []; j := 0; for i from 1 to LinearAlgebra:-ColumnDimension(M) do if ListTools:-Search(i, ud) > 0 then j := j + 1; A := [op(A), ncol[j]]; else A := [op(A), LinearAlgebra:-Column(M, i)]; fi: od: M := Matrix([seq(A[i], i = 1..nops(A))]); displaypt(); res := displayrowcol(cribc); fi: end: shiftright := proc(udlist, cribc) local ud, A, nrow, i, j, res, pt; global M; ud := [seq(seq(j, j = [parse(udlist)][i]), i = 1..nops([parse(udlist)]))]; if min(ud) < 1 or max(ud) > LinearAlgebra:-RowDimension(M) then Maplets:-Display(acheckn3); res := convert(Maplets:-Tools:-Get('PTRANS'), symbol); else nrow := []; for i from 1 to nops(ud) do nrow := [op(nrow), convert(ListTools:-Rotate(convert(LinearAlgebra:-Row(M,ud[i]), list), -1), Vector)]; od: A := []; j := 0; for i from 1 to LinearAlgebra:-RowDimension(M) do if ListTools:-Search(i, ud) > 0 then j := j + 1; A := [op(A), nrow[j]]; else A := [op(A), convert(LinearAlgebra:-Row(M, i), Vector[column])]; fi: od: M := LinearAlgebra:-Transpose(Matrix([seq(A[i], i = 1..nops(A))])); res := displayrowcol(cribc); fi: end: shiftleft := proc(udlist, cribc) local ud, A, nrow, i, j, res, pt; global M; ud := [seq(seq(j, j = [parse(udlist)][i]), i = 1..nops([parse(udlist)]))]; if min(ud) < 1 or max(ud) > LinearAlgebra:-RowDimension(M) then Maplets:-Display(acheckn3); res := convert(Maplets:-Tools:-Get('PTRANS'), symbol); else nrow := []; for i from 1 to nops(ud) do nrow := [op(nrow), convert(ListTools:-Rotate(convert(LinearAlgebra:-Row(M,ud[i]), list), 1), Vector)]; od: A := []; j := 0; for i from 1 to LinearAlgebra:-RowDimension(M) do if ListTools:-Search(i, ud) > 0 then j := j + 1; A := [op(A), nrow[j]]; else A := [op(A), convert(LinearAlgebra:-Row(M, i), Vector[column])]; fi: od: M := LinearAlgebra:-Transpose(Matrix([seq(A[i], i = 1..nops(A))])); displaypt(); res := displayrowcol(cribc); fi: end: displayrowcol := proc(cribc) if Maplets:-Tools:-Get('CHB1') = true and Maplets:-Tools:-Get('CHB2') = true then displaycribcrc(cribc); elif Maplets:-Tools:-Get('CHB1') = true and Maplets:-Tools:-Get('CHB2') = false then displaycribc(cribc); elif Maplets:-Tools:-Get('CHB1') = false and Maplets:-Tools:-Get('CHB2') = true then displayrc(); else hiderc(); fi: end: hiderc := proc() local i, j, res, l; global M; res := ""; for i from 1 to LinearAlgebra:-RowDimension(M) do if i <> LinearAlgebra:-RowDimension(M) then res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1), StringTools:-Char(10)); else res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1)); fi: od: convert(res, symbol); end: displayrc := proc() local i, j, res, l, s; global M; res := " "; s := length(convert(LinearAlgebra:-ColumnDimension(M), string)); for i from 1 to LinearAlgebra:-ColumnDimension(M)-1 do res := cat(res, convert(i, string), cat(seq(" ", j = 1..length(convert(i, string)) mod s + 1))); od: res := cat(res, convert(LinearAlgebra:-ColumnDimension(M), string), StringTools:-Char(10)); l := length(res); for i from 1 to LinearAlgebra:-RowDimension(M) do if i <> LinearAlgebra:-RowDimension(M) then if length(convert(i, string)) = 1 then res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s), StringTools:-Char(10)); else res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s), StringTools:-Char(10)); fi: else if length(convert(i, string)) = 1 then res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1)); else res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1)); fi: fi: od: convert(res, symbol); end: displaycribc := proc(cribc) local i, j, res, cc, s; global M; res := ""; cc := [seq(seq(j, j = [parse(cribc)][i]), i = 1..nops([parse(cribc)]))]; s := length(convert(max(cc), string)); for i from 1 to nops(cc)-1 do res := cat(res, convert(cc[i], string), cat(seq(" ", j = 1..length(convert(cc[i], string)) mod s + 1))); od: res := cat(res, convert(cc[nops(cc)], string), StringTools:-Char(10)); for i from 1 to LinearAlgebra:-RowDimension(M) do if i <> LinearAlgebra:-RowDimension(M) then res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s), StringTools:-Char(10)); else res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s)); fi: od: convert(res, symbol); end: displaycribcrc := proc(cribc) local i, j, res, cc, s; global M; res := " "; cc := [seq(seq(j, j = [parse(cribc)][i]), i = 1..nops([parse(cribc)]))]; s := length(convert(max(cc), string)); for i from 1 to nops(cc)-1 do res := cat(res, convert(cc[i], string), cat(seq(" ", j = 1..length(convert(cc[i], string)) mod s + 1))); od: res := cat(res, convert(cc[nops(cc)], string), StringTools:-Char(10), " "); for i from 1 to nops(cc)-1 do res := cat(res, cat(seq("-", j = 1..s+1))); od: res := cat(res, cat(seq("-", j = 1..s)), StringTools:-Char(10), " "); s := length(convert(LinearAlgebra:-ColumnDimension(M), string)); for i from 1 to LinearAlgebra:-ColumnDimension(M)-1 do res := cat(res, convert(i, string), cat(seq(" ", j = 1..length(convert(i, string)) mod s + 1))); od: res := cat(res, convert(LinearAlgebra:-ColumnDimension(M), string), StringTools:-Char(10)); for i from 1 to LinearAlgebra:-RowDimension(M) do if i <> LinearAlgebra:-RowDimension(M) then if length(convert(i, string)) = 1 then res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s), StringTools:-Char(10)); else res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s), StringTools:-Char(10)); fi: else if length(convert(i, string)) = 1 then res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s)); else res := cat(res, convert(i, string), " ", inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), s)); fi: fi: od: convert(res, symbol); end: csimpletrans := proc(crib, coln) local q, r, M, i, j, mess, ia, res, pt, lcg; global cgraphs; mess := StringTools[Select](StringTools[IsUpper], StringTools[UpperCase](crib)); q := iquo(length(mess), coln); r := irem(length(mess), coln); if r > 0 then M := Matrix(q+1, coln, fill = ""); ia := 0; for i from 1 to q do for j from 1 to coln do ia := ia + 1; M[i,j] := mess[ia]; od: od: for j from 1 to r do ia := ia + 1; M[q+1,j] := mess[ia]; od: else M := Matrix(q, coln, fill = ""); ia := 0; for i from 1 to q do for j from 1 to coln do ia := ia + 1; M[i,j] := mess[ia]; od: od: fi: res := ""; pt := ""; for i from 1 to LinearAlgebra:-RowDimension(M) do pt := cat(pt, op(convert(LinearAlgebra:-Row(M, i), list))); if i <> LinearAlgebra:-RowDimension(M) then res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1), StringTools:-Char(10)); else res := cat(res, inspace(cat(op(convert(LinearAlgebra:-Row(M, i), list))), 1)); fi: od: cgraphs := []; for j from 1 to LinearAlgebra:-ColumnDimension(M) do lcg := cat(op(convert(LinearAlgebra:-Column(M, j), list))); if length(lcg) >= 1 then cgraphs := [op(cgraphs), lcg]; fi: od: convert(res, symbol); end: findgraphs := proc(ctext) local res, i, j, s, sc; global cgraphs; res := ""; for i from 1 to nops(cgraphs) do s := map(convert, [StringTools:-SearchAll(cgraphs[i], StringTools[Select](StringTools[IsUpper], StringTools[UpperCase](ctext)))], string); if nops(s) > 0 and length(cgraphs[i]) > 1 then sc := ""; for j from 1 to nops(s)-1 do sc := cat(sc, s[j], ", "); od: sc := cat(sc, s[nops(s)]); if i <> nops(cgraphs) then res := cat(res, convert(length(cgraphs[i]), string), " graph ", cgraphs[i], " occurs at positions ", sc, " in ciphertext.", StringTools:-Char(10)); else res := cat(res, convert(length(cgraphs[i]), string), " graph ", cgraphs[i], " occurs at positions ", sc, " in ciphertext."); fi: fi: od: convert(res, symbol); end: csetup1 := proc(mess, cn, cb) local ctext, i; global bn, rb, brb, qb, q, r, sctext, ctsct, crib, colnum, ptran; ctext := StringTools[Select](StringTools[IsUpper], StringTools[UpperCase](mess)); crib := convert(cb, symbol); colnum := cn; bn := cn; q := iquo(length(ctext), cn, 'r'); if r = 0 then rb := irem(cn, 4, 'qb'); if rb = 0 then brb := 5; else brb := rb+1; fi: else rb := irem(cn, 4, 'qb') + 1; brb := rb+1; fi: sctext := [StringTools:-LengthSplit(ctext, q)]; ctsct := []; for i from 1 to nops(sctext) do if length(sctext[i]) = q then ctsct := [op(ctsct), [q, q+1]]; else ctsct := [op(ctsct), ["Fixed"]]; fi: od: end: csetup2 := proc() local ctext, bc, bct, i, lb, str; global sctext, q, r; ctsct; ctext := cat(op(sctext)); for i from 1 to nops(sctext) do Maplets:-Tools:-Set(cat("PT", i)('value') = ""); od: bc := []; bct := 0; for i from 1 to nops(sctext)-1 do bc := [op(bc), parse(Maplets:-Tools:-Get(cat("CT", i)))]; bct := bct + parse(Maplets:-Tools:-Get(cat("CT", i))); od: bc := [op(bc), length(ctext) - bct]; sctext := []; lb := 1; for i from 1 to nops(bc) do str := substring(ctext, lb..lb+bc[i]-1); sctext := [op(sctext), str]; Maplets:-Tools:-Set(cat("PT", i)('value') = str); lb := lb + bc[i]; od: end: lcribct := proc(gfind) local ctext, bc, i, lb, str, rlist; global sctext; ctext := cat(op(sctext)); rlist := map(convert, [parse(gfind)], string); for i from 1 to nops(rlist) do ctext := StringTools:-SubstituteAll(ctext, rlist[i], StringTools:-LowerCase(rlist[i])) od: bc := []; for i from 1 to nops(sctext) do bc := [op(bc), length(sctext[i])]; od: sctext := []; lb := 1; for i from 1 to nops(bc) do str := substring(ctext, lb..lb+bc[i]-1); sctext := [op(sctext), str]; Maplets:-Tools:-Set(cat("PT", i)('value') = str); lb := lb + bc[i]; od: end: UCctext := proc() local ctext, bc, i, lb, str; global sctext; ctext := StringTools:-UpperCase(cat(op(sctext))); bc := []; for i from 1 to nops(sctext) do bc := [op(bc), length(sctext[i])]; od: sctext := []; lb := 1; for i from 1 to nops(bc) do str := substring(ctext, lb..lb+bc[i]-1); sctext := [op(sctext), str]; Maplets:-Tools:-Set(cat("PT", i)('value') = str); lb := lb + bc[i]; od: end: globunassign := proc() global sctext, crib, colnum, ptran, sg; sctext := "": crib := "": colnum := "": ptran := "": sg := "": end: sctext := "": crib := "": colnum := "": ptran := "": sg := "": blockn4 := proc() global M; convert(cat("Array Elements to swap contain number outside list of possible row and column numbers. Row Numbers are between 1 and ", convert(LinearAlgebra:-RowDimension(M), string), ". Column Numbers are between 1 and ", convert(LinearAlgebra:-ColumnDimension(M), string), ". Check your row and column numbers for your array elements."), symbol); end: acheckn4 := Maplet(onstartup = Action(RunWindow('WE4'), Evaluate('F' = "blockn4")), Window['WE4']('title' = "Error!", [ BoxRow(TextBox['F'](4..38, 'foreground' = 'red', 'font' = Font("arial", bold, 16), 'background' = 'WhiteSmoke')), [Button("Go Back to Keyword Columnar Transposition Breaker Window.", 'font' = Font("arial", bold, 15), Shutdown())]] )): blockn3 := proc() global M; convert(cat("Row Number list contains number outside list of possible row numbers, which is between 1 and ", convert(LinearAlgebra:-RowDimension(M), string), ". Check your row number list."), symbol); end: acheckn3 := Maplet(onstartup = Action(RunWindow('WE3'), Evaluate('F' = "blockn3")), Window['WE3']('title' = "Error!", [ BoxRow(TextBox['F'](2..36, 'foreground' = 'red', 'font' = Font("arial", bold, 16), 'background' = 'WhiteSmoke')), [Button("Go Back to Keyword Columnar Transposition Breaker Window.", 'font' = Font("arial", bold, 15), Shutdown())]] )): blockn2 := proc() global M; convert(cat("Column Number list contains number outside list of possible column numbers, which is between 1 and ", convert(LinearAlgebra:-ColumnDimension(M), string), ". Check your column number list."), symbol); end: acheckn2 := Maplet(onstartup = Action(RunWindow('WE2'), Evaluate('F' = "blockn2")), Window['WE2']('title' = "Error!", [ BoxRow(TextBox['F'](2..38, 'foreground' = 'red', 'font' = Font("arial", bold, 16), 'background' = 'WhiteSmoke')), [Button("Go Back to Keyword Columnar Transposition Breaker Window.", 'font' = Font("arial", bold, 15), Shutdown())]] )): blockn1 := proc() global sctext; convert(cat("Block Number list contains number outside list of possible block numbers, which is between 1 and ", convert(nops(sctext), string), ". Check your block number list."), symbol); end: acheckn1 := Maplet(onstartup = Action(RunWindow('WE1'), Evaluate('F' = "blockn1")), Window['WE1']('title' = "Error!", [ BoxRow(TextBox['F'](2..36, 'foreground' = 'red', 'font' = Font("arial", bold, 16), 'background' = 'WhiteSmoke')), [Button("Go Back to Keyword Columnar Transposition Breaker Window.", 'font' = Font("arial", bold, 15), Shutdown())]] )): fin := "false": kgoing := "false": while fin = "false" do lloc := []: subsetup := Maplet('onstartup' = 'A1', Window['W1']( 'title'="Keyword Columnar Transposition Cipher Breaker", BoxColumn('halign' = 'none', 'background' = 'navy', BoxRow('halign' = 'none', Label("Ciphertext: " , 'font' = Font("arial", 17)), TextBox['CTEXT']('value' = StringTools:-UpperCase(cat(op(sctext))), 'font' = Font("arial", bold, 16), 'foreground' = 'red', 4..50)), BoxRow('halign' = 'none', Label("Enter Crib: " , 'font' = Font("arial", 17)), TextBox['CRIB']('value' = convert(crib, string), 'font' = Font("arial", bold, 16), 'foreground' = 'black', 1..20)), BoxRow('halign' = 'left', BoxColumn('halign' = 'right', seq(VerticalGlue(), i = 1..4), BoxRow('halign' = 'right', Label("Crib Column #: ", 'font' = Font("arial", 17)), TextBox['CN']('value' = colnum, 'font' = Font("arial", bold, 16), 1..5)), BoxRow(" ", Button['BS']("Display Crib", 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "csimpletrans", Argument('CRIB', 'quotedtext' = 'true'), 'CN'), SetOption('BSGRAPH'('enabled') = 'true') ))), seq(VerticalGlue(), i = 1..7)), TextBox['PTRANS']('value' = ptran, 'foreground' = 'blue', 'font' = Font("Monospaced", bold, 16), 'wrapped' = 'false', 5..40), " ", Button("How does \n this work?", 'background' = 'yellow', 'width' = 95, RunDialog('MTRANSB')), seq(HorizontalGlue(), i = 1..8)), BoxRow('halign' = 'none', Button['BSGRAPH']("Search For Graphs", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('SGRAPHS' = "findgraphs", Argument('CTEXT', 'quotedtext' = 'true')), SetOption('BCRYPT'('enabled') = 'true') )), TextBox['SGRAPHS']('font' = Font("arial", bold, 16), 'foreground' = 'black', 'background' = 'white', 7..60) ), BoxRow('halign' = 'none', 'background' = 'navy', Button("Clear All", 'font' = Font("arial", bold, 15), Action(SetOption('CTEXT' = "" ), SetOption('CRIB' = "" ), SetOption('CN' = ""), SetOption('PTRANS' = ""), SetOption('SGRAPHS' = ""), SetOption('BSGRAPH'('enabled') = 'false'), SetOption('BCRYPT'('enabled') = 'false') ) ), " ", Button['BCRYPT']("Cryptanalyze Message", 'enabled' = 'false', 'font' = Font("arial", bold, 15), 'foreground' = 'red', Action(Evaluate('function' = "csetup1", Argument('CTEXT', 'quotedtext' = 'true'), 'CN', Argument('CRIB', 'quotedtext' = 'true')), Shutdown("true"))), " ", Button("Quit", 'font' = Font("arial", bold, 15), Shutdown() ) ) ) ), Action['A1'](RunWindow('W1')), ButtonGroup['BG1'](), MessageDialog['MTRANSB']( "The goal is this step is to determine the number of columns used in the keyword columnar transposition. The user enters a possible number of columns and spells out how the crib would look when spelled out in the rectangular array. The user then attempts to search for the graphs in the ciphertext that result from columns of the rectangular array. If the graphs are found in the ciphertext, a likely number of columns is discovered. Note that when changing the crib column, number the user should click the Display Crib button update what the crib would look like before clicking the Search for Graphs button.", 'type'='information') ): kgoing := Maplets[Display]( subsetup ): if kgoing = "true" then sbreaker := Maplet('onstartup' = 'A1', Window['W1']('title' = "Keyword Columnar Transposition Cipher Breaker", BoxColumn('halign' = 'none', 'vscroll' = 'as_needed', 'hscroll' = 'as_needed', 'background' = 'navy', BoxColumn('halign' = 'none', 'valign' = 'none', 'background' = 'Teal', spacing = 1, inset = 1, 'border' = 'true', 'font' = Font("times", bold, 17), 'caption'= " Ciphertext Blocks ", seq(BoxColumn('halign' = 'none', spacing = 1, inset = 1, BoxRow('halign' = 'none', spacing = 1, inset = 1, seq(BoxColumn(TextField[cat("PT", convert((i-1)*4+j, string))]('halign' = 'center', 'width' = 15, 'value' = sctext[(i-1)*4+j], 'editable' = 'false', 'font' = Font("times", bold, 16), 'foreground' = 'red', 'background' = 'white'), BoxRow(Label("Block #: ", 'font' = Font("arial", 17)), TextField[cat("BN", convert((i-1)*4+j, string))]('value' = (i-1)*4+j, 2, 'font' = Font("times", bold, 16), 'editable' = 'false', 'background' = 'white'), Label(" Character #: ", 'font' = Font("arial", 17)), DropDownBox[cat("CT", convert((i-1)*4+j, string))]('value' = ctsct[(i-1)*4+j][1], ctsct[(i-1)*4+j], 'font' = Font("times", 15),onchange = Evaluate('function' = "csetup2" )) )), j = 1..4) )), i = 1..qb), BoxColumn('halign' = 'none', spacing = 1, inset = 1, BoxRow('halign' = 'none', spacing = 1, inset = 1, seq(BoxColumn(TextField[cat("PT", convert(qb*4+j, string))]('halign' = 'center', 'width' = 15, 'value' = sctext[qb*4+j], 'font' = Font("times", bold, 16), 'editable' = 'false', 'foreground' = 'red', 'background' = 'white'), BoxRow(Label("Block #: ", 'font' = Font("arial", 17)), TextField[cat("BN", convert(qb*4+j, string))]('value' = qb*4+j, 2, 'font' = Font("times", bold, 16), 'editable' = 'false', 'background' = 'white'), Label(" Character #: ", 'font' = Font("arial", 17)), DropDownBox[cat("CT", convert(qb*4+j, string))]('value' = ctsct[qb*4+j][1], ctsct[qb*4+j], 'font' = Font("times", 15), onchange = Evaluate('function' = "csetup2" )))), j = 1..rb), seq(BoxColumn('background' = 'black', TextField[cat("PT", convert(qb*4+j, string))]('halign' = 'center', 'width' = 20, 'enabled' = 'false', 'background' = 'black', 'font' = Font("times", bold, 16), 'foreground' = 'red'), BoxRow('background' = 'black', Label("Block #: ", 'font' = Font("arial", 17)), TextField[cat("BN", convert(qb*4+j, string))]('value' = qb*4+j, 2, 'enabled' = 'false', 'background' = 'black', 'width' = 15, 'visible' = 'false', 'font' = Font("times", bold, 16)), Label(" Character #: ", 'font' = Font("arial", 17)), DropDownBox[cat("CT", convert(qb*4+j, string))]('value' = length(sctext[nops(sctext)]), [length(sctext[nops(sctext)])], 'font' = Font("times", 15), 'visible' = 'false'))), j = brb..4) ) ), BoxRow('halign' = 'none', Label("Crib Graphs: " , 'font' = Font("arial", 17)), TextBox['CGRAPHS']('value' = op(map(convert, cgraphs, symbol)), 'font' = Font("arial", bold, 16), 'foreground' = 'black', 'background' = 'white', 1..10), " ", Label("Crib Graph(s) to Locate: " , 'font' = Font("arial", 17)), TextBox['LCG']( 'font' = Font("arial", bold, 16), 'foreground' = 'black', 'background' = 'white', 1..7), Button['BCG']("Locate", 'font' = Font("arial", bold, 15), Action(Evaluate('function' = "lcribct", Argument('LCG', 'quotedtext' = 'true')) )), " ", Button['BCCG']("Capitalize Ciphertext" , 'font' = Font("arial", bold, 15), Action(Evaluate('function' = "UCctext") )) )), BoxColumn( BoxRow('halign' = 'none', BoxColumn(seq(VerticalGlue(), i = 1..7), 'background' = 'red', BoxColumn(Label("Block #'s for Columns ", 'font' = Font("arial", 17)), TextBox['CN']('font' = Font("arial", bold, 18), 1..15), " ", Button['BS']("Create Message Array", 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "linecol", Argument('CN', 'quotedtext' = 'true')), SetOption('CHB1'('enabled') = 'true'), SetOption('CHB2'('enabled') = 'true'), SetOption('BUP'('enabled') = 'true'), SetOption('BDOWN'('enabled') = 'true'), SetOption('BLEFT'('enabled') = 'true'), SetOption('BRIGHT'('enabled') = 'true'), SetOption('BSWAP'('enabled') = 'true') )), " ", BoxRow(Label("Show Block Column #'s: " , 'font' = Font("arial", 17)), CheckBox['CHB1']('value' = 'false', 'enabled' = 'false', 'background' = 'gold', onchange = Action(Evaluate('PTRANS' = "displayrowcol", Argument('CN', 'quotedtext' = 'true')) )))), seq(VerticalGlue(), i = 1..5), Button("How does \n this work?", 'background' = 'yellow', 'width' = 95, RunDialog('MCT1'))), TextBox['PTRANS']('foreground' = 'blue', 'font' = Font("Monospaced", bold, 16), 'wrapped' = 'false', 12..45), BoxColumn('background' = 'red', BoxRow(Label("Show Rows/Cols in Order: " , 'font' = Font("arial", 17)), CheckBox['CHB2']('value' = 'false', 'enabled' = 'false', 'background' = 'gold', onchange = Action(Evaluate('PTRANS' = "displayrowcol", Argument('CN', 'quotedtext' = 'true')) )), " ", Button("How does \n this work?", 'width' = 95, RunDialog('MCT2'))), BoxRow(Label("Shift Columns: " , 'font' = Font("arial", 17)), TextBox['COLN']('font' = Font("arial", bold, 16), 'background' = 'white', 1..15), Button['BUP']("UP", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "shiftup", Argument('COLN', 'quotedtext' = 'true'), Argument('CN', 'quotedtext' = 'true')) )), Button['BDOWN']("DOWN", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "shiftdown", Argument('COLN', 'quotedtext' = 'true'), Argument('CN', 'quotedtext' = 'true')) ))), BoxRow(Label("Shift Rows: " , 'font' = Font("arial", 17)), TextBox['ROWN']('font' = Font("arial", bold, 16), 'background' = 'white', 1..15), Button['BLEFT']("LEFT", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "shiftleft", Argument('ROWN', 'quotedtext' = 'true'), Argument('CN', 'quotedtext' = 'true')) )), Button['BRIGHT']("RIGHT", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "shiftright", Argument('ROWN', 'quotedtext' = 'true'), Argument('CN', 'quotedtext' = 'true')) ))), BoxColumn('background' = 'red', BoxColumn(BoxRow('halign' = 'none', Label("From: ", 'font' = Font("arial", 17)), BoxRow(BoxColumn(TextField['RF'](2, 'halign' = 'center', 'font' = Font("arial", bold, 16)), Label("Row", 'font' = Font("arial", 17))), BoxColumn(TextField['CF'](2, 'halign' = 'center', 'font' = Font("arial", bold, 16)), Label("Col", 'font' = Font("arial", 17))) ), Label(" To: ", 'font' = Font("arial", 17)), BoxRow(BoxColumn(TextField['RT'](2, 'halign' = 'center', 'font' = Font("arial", bold, 16)), Label("Row", 'font' = Font("arial", 17))), BoxColumn(TextField['CT'](2, 'halign' = 'center', 'font' = Font("arial", bold, 16)), Label("Col", 'font' = Font("arial", 17))) ) ), Button['BSWAP']("SWAP", 'enabled' = 'false', 'font' = Font("arial", bold, 15), Action(Evaluate('PTRANS' = "swapM", 'RF', 'CF', 'RT', 'CT', Argument('CN', 'quotedtext' = 'true')) )))))), BoxRow('halign' = 'none', Label("Plaintext: " , 'font' = Font("arial", 17)), TextBox['PT']('font' = Font("arial", bold, 16), 'foreground' = 'blue', 'background' = 'white', 3..60) ), BoxRow('halign' = 'center', 'background' = 'navy', Button( "Go back to previous window", 'font' = Font("arial", bold, 15), Shutdown("false")), Button( "Decipher another message", 'font' = Font("arial", bold, 15), Action(Evaluate('function' = "globunassign"), Shutdown("false"))), Button( "Clear", 'font' = Font("arial", bold, 15), Action(SetOption('CHB1'('enabled') = 'false'), SetOption('CHB2'('enabled') = 'false'), SetOption('CHB1'('value') = 'false'), SetOption('CHB2'('value') = 'false'), SetOption('BUP'('enabled') = 'false'), SetOption('BDOWN'('enabled') = 'false'), SetOption('BLEFT'('enabled') = 'false'), SetOption('BRIGHT'('enabled') = 'false'), SetOption('BSWAP'('enabled') = 'false'), SetOption('CN' = ""), SetOption('PTRANS' = ""), SetOption('COLN' = ""), SetOption('ROWN' = ""), SetOption('PT' = ""), SetOption('RF' = ""), SetOption('CF' = ""), SetOption('RT' = ""), SetOption('CT' = ""))), Button("Quit", 'font' = Font("arial", bold, 15), Shutdown("true") )) ) )), MessageDialog['MCT1']( "Using the ciphertext blocks given above, the user can list the blocks of ciphertext as columns by listing the columns that will spell out the crib graphs and clicking the Create Message Array button. Consecutive columns can be listed in intervals from smallest to largest using the s..l notation. For example, to list columns 1 through 5 consecutively, the user would enter 1..5. To enter columns 2, 4, and 6 the user would enter 2, 4, 6 The block numbers can be placed over their respective columns by checking the Show Block Column #'s checkbox.", 'type' = 'information'), MessageDialog['MCT2']( "This sequence of buttons and checkbox gives the user the ability to adjust the keyword columnar rectangular array. By checking the Show Rows/Cols in Order checkbox, the user can list the rows and columns of the array in order. To move columns of the array either up or down, the user can enter the columns to move and clicking the UP or DOWN buttons. The designated columns are listed separated by commas. Consecutive columns can be listed in intervals from smallest to largest using the s..l notation. For example, to list columns 1 through 5 consecutively, the user would enter 1..5. To enter columns 2, 4, and 6 the user would enter 2, 4, 6 To move the rows of the array either left or right, the user can enter the rows to move using the same notation for the columns described above and clicking the LEFT or RIGHT buttons. The user can switch elements in the array by entering the row and columns numbers of the two elements to switch and clicking the SWAP button.", 'type' = 'information'), Action['A1'](RunWindow('W1')) ): fin := Maplets[Display]( sbreaker ): else fin := "true" fi: od: