1foreach($data as $key => &$value)
2{
3 $output[$value["id"]] = &$value;
4 $output[$value["id"]];
5
6}
1public static string DoEncrypt(string unencryptedString)
2{
3 string encryptedString = "";
4 unencryptedString = new string(unencryptedString.ToCharArray().Reverse().ToArray());
5 foreach (char character in unencryptedString.ToCharArray())
6 {
7 string randomizationSeed = (encryptedString.Length > 0) ? unencryptedString.Substring(0, encryptedString.Length) : "";
8 encryptedString += GetRandomSubstitutionArray(randomizationSeed)[int.Parse(character.ToString())];
9 }
10
11 return Shuffle(encryptedString);
12}
13
14public static string DoDecrypt(string encryptedString)
15{
16 // Unshuffle the string first to make processing easier.
17 encryptedString = Unshuffle(encryptedString);
18
19 string unencryptedString = "";
20 foreach (char character in encryptedString.ToCharArray().ToArray())
21 unencryptedString += GetRandomSubstitutionArray(unencryptedString).IndexOf(int.Parse(character.ToString()));
22
23 // Reverse string since encrypted string was reversed while processing.
24 return new string(unencryptedString.ToCharArray().Reverse().ToArray());