Vigenère cipher: Difference between revisions
Content added Content deleted
(Updated second D entry) |
|||
Line 544:
s.toUpper.removechars("^A-Z").map!q{ a - 'A' };
string _v2s(R)(R v)
return v.map!(x => uppercase[x.mod(26)]).text;
}
enum encrypt = (in string txt, in string key)
txt._s2v.zip(key._s2v.cycle).map!q{ a[0] + a[1] }._v2s;
enum decrypt = (in string txt, in string key)
txt._s2v.zip(key._s2v.cycle).map!q{ a[0] - a[1] }._v2s;
|