Jump to content
Tuts 4 You

[C#] Make Encoder from Decoder


Meteor2142

Recommended Posts

Posted

Hello guys, 


 


Have a some problem, need to make an encoder code from decoder code.


It's possible?


 


Here it is:



private static byte[] ByteArray = new byte[]
{
198, 155, 210, 181, 170, 198, 80, 247, 165, 134, 249, 215, 18, 204, 212, 8, 71, 122, 144, 187, 164, 225, 159, 57
}; private static string Decoder(string MOLmemeNWSgZXjzu, byte[] VEuOxZqRKRisj)
{
byte[] array = Convert.FromBase64String(MOLmemeNWSgZXjzu);
for (int i = 0; i < array.Length; i++)
{
for (int j = 0; j < VEuOxZqRKRisj.Length; j++)
{
array[i] ^= VEuOxZqRKRisj[j];
}
}
string text = "";
byte[] array2 = array;
for (int k = 0; k < array2.Length; k++)
{
byte b = array2[k];
text += (char)b;
}
return text;
} private static string deshifrator(string InString, byte[] InByte)
{
byte[] array = Convert.FromBase64String(InString);
for (int i = 0; i < array.Length; i++)
{
for (int j = 0; j < InByte.Length; j++)
{
array[i] ^= InByte[j];
}
}
string text = "";
byte[] array2 = array;
for (int k = 0; k < array2.Length; k++)
{
byte b = array2[k];
text += (char)b;
}
return text;
}

Encoded code for ex.: WHJ4f25mJV9jeW5qb2JlbCVfY3luam8= 


Decoded: System.Threading.Thread


 


Ofcourse its part of biggest code, that uses some kinda of resource reflection, but nvm.


Ty!


Posted

private static string shifrator(string InString, byte[] InByte)

        {

            byte[] array = Encoding.ASCII.GetBytes(InString);

            for (int i = 0; i < array.Length; i++)

            {

                for (int j = 0; j < InByte.Length; j++)

                {

                    array ^= InByte[j];

                }

            }

            return Convert.ToBase64String(array);

        }

  • Like 2
Posted

Спасибо! 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...