Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static string DeriveKey(string enteredKey)
- {
- const int BLOCK_SIZE = 32;
- int R = enteredKey.Length << 8 % 64;
- int S = enteredKey.Length << 8 % 64;
- int T = enteredKey.Length << 16 % 36;
- int[][] STATE = new int[enteredKey.Length][];
- byte[] result = new byte[BLOCK_SIZE];
- ulong temp = BLOCK_SIZE / 2;
- for (int i = 0; i < BLOCK_SIZE; i++)
- {
- for (int j = 0; j < enteredKey.Length; j++)
- {
- for (int k = 0; k < BLOCK_SIZE; k++)
- {
- R += enteredKey[j];
- for (int l = 0; l < 10; l++)
- {
- S -= k << l;
- }
- S += enteredKey[j];
- T += enteredKey[j];
- for (int l = 0; l < 100; l++)
- {
- T -= j << j;
- }
- temp += (ulong)(T % S % R);
- temp += 16;
- }
- int counter = BLOCK_SIZE;
- while (counter > 0)
- {
- STATE[j] = new int[3] { R, S, T };
- R += S;
- S += T;
- T += R;
- counter--;
- }
- }
- temp = 0;
- for (int m = 0; m < BLOCK_SIZE; m++)
- {
- for (int si = 0; si < 3; si++)
- {
- temp += (ulong)(STATE[m][si] << BLOCK_SIZE);
- }
- result[i] ^= (byte)(temp | temp >> 8 | temp >> 16 | temp >> 24);
- }
- }
- string finalResult = Convert.ToBase64String(result);
- return finalResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement