Playfair cipher: Difference between revisions

Content added Content deleted
(Updated D entry)
(Updated D entry)
Line 195: Line 195:
return _canonicalize(s)
return _canonicalize(s)
.matchAll(r"(.)(?:(?!\1)(.))?".regex)
.matchAll(r"(.)(?:(?!\1)(.))?".regex)
//.map!(m => enc[m[0].leftJustify(2, 'X')])
.map!(m => enc[m[0].leftJustify(2, 'X')])
.map!(m => cast()enc[m[0].leftJustify(2, 'X')])
.join(" ");
.join(" ");
}
}
Line 204: Line 203:
.chunks(2)
.chunks(2)
//.map!dec
//.map!dec
.map!(p => cast()dec[p.text])
.map!(p => dec[p.text])
.join(" ");
.join(" ");
}
}