Anonymous user
Vigenère cipher: Difference between revisions
Modified D version
(Improved D code) |
(Modified D version) |
||
Line 315:
=={{header|D}}==
ASCII only:
<lang d>import std.stdio, std.string;
string encrypt(
string encoded;
foreach (i, c; text.toupper().removechars("^A-Z"))
Line 325 ⟶ 324:
return encoded;
}
string decrypt(
string decoded;
foreach (i, c; encoded.toupper().removechars("^A-Z"))
Line 332 ⟶ 331:
return decoded;
}
void main() {
auto key = "VIGENERECIPHER";
auto
" The jaws that bite, the claws that catch!";
auto
writeln(
}</lang>
Output:
|