wasSharp
/Cryptography.cs |
@@ -187,7 +187,7 @@ |
var plug = plugs[Array.IndexOf(rotors, rotor)]; |
var i = Array.IndexOf(def_rotors[rotor], plug); |
if (i.Equals(0)) continue; |
def_rotors[rotor] = Arrays.ConcatenateArrays(new[] {plug}, |
def_rotors[rotor] = Arrays.ConcatenateArrays(new[] { plug }, |
Arrays.GetSubArray(Arrays.DeleteSubArray(def_rotors[rotor], i, i), i, -1), |
Arrays.GetSubArray(Arrays.DeleteSubArray(def_rotors[rotor], i + 1, -1), 0, i - 1)); |
} |
@@ -225,7 +225,7 @@ |
|
// Reflect |
var x = Array.IndexOf(def_reflectors[reflector], l); |
l = (x + 1)%2 == 0 ? def_reflectors[reflector][x - 1] : def_reflectors[reflector][x + 1]; |
l = (x + 1) % 2 == 0 ? def_reflectors[reflector][x - 1] : def_reflectors[reflector][x + 1]; |
|
// Reverse the order of the rotors. |
Array.Reverse(rotors); |
@@ -265,7 +265,7 @@ |
++i; |
continue; |
} |
var m = j%enc_key.Length; |
var m = j % enc_key.Length; |
exp_key += enc_key[m]; |
++j; |
++i; |
@@ -392,4 +392,4 @@ |
return new string(input); |
} |
} |
} |
} |