I'm relatively new to this I have a random function that uses a keyword as a seed to encrypted some data i.e. have plain-text data 'abcd' and this function will randomly change the order 'dcab'. I am struggling to think of a way to reverse this function so I am able to retrieve back the original plain-text i.e. transform 'dcab' back to 'abcd' using the keyword. I have been looking at other post on here but I am still finding this difficult.
Here is the function:
Random random = new Random(q.GetHashCode());
for (int i = 0; i < data.Length; i++)
{
int idx = random.Next(i, data.Length);
//swap elements
byte tmp = data[i];
data[i] = data[idx];
data[idx] = tmp;
}
Any suggestions please?