Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -1,20 +1,20 @@
import std.stdio, std.range, std.ascii, std.string, std.algorithm,
std.conv;
enum mod = (in int m, in int n) pure nothrow @safe @nogc =>
immutable mod = (in int m, in int n) pure nothrow @safe @nogc =>
((m % n) + n) % n;
enum _s2v = (in string s) pure /*nothrow*/ @safe =>
immutable _s2v = (in string s) pure /*nothrow*/ @safe =>
s.toUpper.removechars("^A-Z").map!q{ a - 'A' };
string _v2s(R)(R v) pure /*nothrow*/ @safe {
return v.map!(x => uppercase[x.mod(26)]).text;
}
enum encrypt = (in string txt, in string key) pure /*nothrow*/ @safe =>
immutable encrypt = (in string txt, in string key) pure /*nothrow*/ @safe =>
txt._s2v.zip(key._s2v.cycle).map!q{ a[0] + a[1] }._v2s;
enum decrypt = (in string txt, in string key) pure /*nothrow*/ @safe =>
immutable decrypt = (in string txt, in string key) pure /*nothrow*/ @safe =>
txt._s2v.zip(key._s2v.cycle).map!q{ a[0] - a[1] }._v2s;
void main() {