Методы шифрования

  • Автор темы HHIDE_DUMP
  • Дата начала
  • Просмотры 968
  • На форуме работает ручное одобрение пользователей. Это значит, что, если Ваша причина регистрации не соответствует тематике форума, а также Вы используете временную почту, Ваша учётная запись будет отклонена без возможности повторной регистрации. В дальнейшем - пожизненная блокировка обоих аккаунтов за создание мультиаккаунта.
  • Мы обновили Tor зеркало до v3!
    Для входа используйте следующий url: darkv3nw2...bzad.onion/
  • Мы вновь вернули telegram чат форуму, вступайте, общайтесь, задавайте любые вопросы как администрации, так и пользователям!
    Ссылка: https://t.me/chat_dark_time

HHIDE_DUMP

Гость
H

HHIDE_DUMP

Гость
RSM
Код:
public byte[] RSMEncrypt(byte[] input, byte[] key)
        {
            Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(key, new byte[8], 1);
            RijndaelManaged rijndaelManaged = new RijndaelManaged();
            rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(16);
            rijndaelManaged.IV = rfc2898DeriveBytes.GetBytes(16);
            byte[] array = new byte[input.Length + 16];
            Buffer.BlockCopy(Guid.NewGuid().ToByteArray(), 0, array, 0, 16);
            Buffer.BlockCopy(input, 0, array, 16, input.Length);
            return rijndaelManaged.CreateEncryptor().TransformFinalBlock(array, 0, array.Length);
        }
        public byte[] RSMDecrypt(byte[] data, byte[] key)
        {
            Rfc2898DeriveBytes R = new Rfc2898DeriveBytes(key, new byte[8], 1);
            RijndaelManaged T = new RijndaelManaged();
            T.Key = R.GetBytes(16);
            T.IV = R.GetBytes(16);
            byte[] O = T.CreateDecryptor().TransformFinalBlock(data, 0, data.Length);
            byte[] U = new byte[O.Length - 16];
            Buffer.BlockCopy(O, 16, U, 0, O.Length - 16);
            return U;
        }
RC4
Код:
public static byte[] RC4Encrypt(byte[] input, string key)

        {
            int num;
            byte num3;
            byte[] bytes = Encoding.ASCII.GetBytes(key);
            byte[] buffer2 = new byte[0x100];
            byte[] buffer3 = new byte[0x100];
            for (num = 0; num < 0x100; num++)
            {
                buffer2[num] = (byte)num;
                buffer3[num] = bytes[num % bytes.GetLength(0)];
            }
            int index = 0;
            for (num = 0; num < 0x100; num++)
            {
                index = ((index + buffer2[num]) + buffer3[num]) % 0x100;
                num3 = buffer2[num];
                buffer2[num] = buffer2[index];
                buffer2[index] = num3;
            }
            num = index = 0;
            for (int i = 0; i < input.GetLength(0); i++)
            {
                num = (num + 1) % 0x100;
                index = (index + buffer2[num]) % 0x100;
                num3 = buffer2[num];
                buffer2[num] = buffer2[index];
                buffer2[index] = num3;
                int num5 = (buffer2[num] + buffer2[index]) % 0x100;
                input[i] = (byte)(input[i] ^ buffer2[num5]);
            }
            return input;
        }
        public static byte[] RC4(byte[] bytes, string Key)
        {
            byte[] key = System.Text.Encoding.ASCII.GetBytes(Key);
            Byte[] s = new Byte[256];
            Byte[] k = new Byte[256];
            Byte temp;
            int i, j;
            for (i = 0; i < 256; i++)
            {
                s[i] = (Byte)i;
                k[i] = key[i % key.GetLength(0)];
            }
            j = 0;
            for (i = 0; i < 256; i++)
            {
                j = (j + s[i] + k[i]) % 256;
                temp = s[i];
                s[i] = s[j];
                s[j] = temp;
            }
            i = j = 0;
            for (int x = 0; x < bytes.GetLength(0); x++)
            {
                i = (i + 1) % 256;
                j = (j + s[i]) % 256;
                temp = s[i];
                s[i] = s[j];
                s[j] = temp;
                int t = (s[i] + s[j]) % 256;
                bytes[x] ^= s[t];
            }
            return bytes;
        }
Poly Rev
Код:
public static byte[] PolyRecEncrypt(byte[] byte_0, string string_0)

        {
            byte num = (byte)new Random().Next(1, 0xff);
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            byte[] array = new byte[byte_0.Length + 1];
            int index = 0;
            for (int i = 0; i <= (byte_0.Length - 1); i++)
            {
                array[i] = (byte)((byte_0[i] ^ bytes[index]) ^ num);
                Array.Reverse(bytes);
                if (index == (bytes.Length - 1))
                {
                    index = 0;
                }
                else
                {
                    index++;
                }
            }
            Array.Resize<byte>(ref array, array.Length);
            array[array.Length - 1] = num;
            Array.Reverse(array);
            return array;
        }
        public static byte[] PolyRevDecrypt(byte[] data, string pass)
        {
            Array.Reverse(data);
            byte rndByte = data[data.Length - 1];
            byte[] passByte = System.Text.Encoding.ASCII.GetBytes(pass);
            byte[] Out = new byte[data.Length + 1];
            int u = 0;
            for (int i = 0; i <= data.Length - 1; i++)
            {
                Out[i] = (byte)((data[i] ^ rndByte) ^ passByte[u]);
                Array.Reverse(passByte);
                if (u == passByte.Length - 1) u = 0;
                else u += 1;
            }
            Array.Resize(ref Out, Out.Length - 2);
            return Out;
        }
</byte>
RijNdael
Код:
public static byte[] PolyRecEncrypt(byte[] byte_0, string string_0)

        {
            byte num = (byte)new Random().Next(1, 0xff);
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            byte[] array = new byte[byte_0.Length + 1];
            int index = 0;
            for (int i = 0; i <= (byte_0.Length - 1); i++)
            {
                array[i] = (byte)((byte_0[i] ^ bytes[index]) ^ num);
                Array.Reverse(bytes);
                if (index == (bytes.Length - 1))
                {
                    index = 0;
                }
                else
                {
                    index++;
                }
            }
            Array.Resize<byte>(ref array, array.Length);
            array[array.Length - 1] = num;
            Array.Reverse(array);
            return array;
        }
        public static byte[] PolyRevDecrypt(byte[] data, string pass)
        {
            Array.Reverse(data);
            byte rndByte = data[data.Length - 1];
            byte[] passByte = System.Text.Encoding.ASCII.GetBytes(pass);
            byte[] Out = new byte[data.Length + 1];
            int u = 0;
            for (int i = 0; i <= data.Length - 1; i++)
            {
                Out[i] = (byte)((data[i] ^ rndByte) ^ passByte[u]);
                Array.Reverse(passByte);
                if (u == passByte.Length - 1) u = 0;
                else u += 1;
            }
            Array.Resize(ref Out, Out.Length - 2);
            return Out;
        }
XOR
Код:
public static byte[] XorEncrypt(byte[] byte_0, string string_0, int int_0)

        {
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            for (int i = 0; i < byte_0.Length; i++)
            {
                byte_0[i] = (byte)(byte_0[i] ^ ((byte)((bytes[i % ((int)bytes.Length)] >> ((i + int_0) + bytes.Length)) & 0xff)));
            }
            return byte_0;
        }
        public static byte[] XORDecrypt(byte[] input, string Key, int amount)
        {
            byte[] key = Encoding.ASCII.GetBytes(Key);
            for (int i = 0; i < input.Length; i++) input[i] ^= (byte)(key[i % key.Length] >> (i + amount + key.Length) & 255);
            return input;
        }
3DES
Код:
public static byte[] TridesEncrypt(byte[] byte_0, string string_0)

        {
            TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
            tripleDESCryptoServiceProvider.Key = Encoding.UTF8.GetBytes(string_0);
            tripleDESCryptoServiceProvider.Mode = CipherMode.ECB;
            tripleDESCryptoServiceProvider.Padding = PaddingMode.PKCS7;
            ICryptoTransform cryptoTransform = tripleDESCryptoServiceProvider.CreateEncryptor();
            byte[] result = cryptoTransform.TransformFinalBlock(byte_0, 0, byte_0.Length);
            tripleDESCryptoServiceProvider.Clear();
            return result;
        }
        public static byte[] TripleDESDecrypt(byte[] bytes, string Key)
        {
            byte[] inputArray = bytes;
            TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
            tripleDES.Key = UTF8Encoding.UTF8.GetBytes(Key);
            tripleDES.Mode = CipherMode.ECB;
            tripleDES.Padding = PaddingMode.PKCS7;
            ICryptoTransform cTransform = tripleDES.CreateDecryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
            tripleDES.Clear();
            return resultArray;
        }
Poly DEX
Код:
public static byte[] PolyDEXEncrypt(byte[] byte_0, string string_0)

        {
            byte[] buffer3;
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            int length = byte_0.Length;
            if (bytes.Length >= length)
            {
                buffer3 = bytes;
            }
            else
            {
                byte[] buffer4 = BitConverter.GetBytes(Math.Round((double)3.1415926535897931, 3));
                byte[] dst = new byte[length];
                Buffer.BlockCopy(bytes, 0, dst, 0, bytes.Length);
                for (int j = bytes.Length; j < length; j++)
                {
                    dst[j] = (byte)((bytes[(j - bytes.Length) % bytes.Length] ^ dst[j - 1]) % 0x100);
                }
                for (int k = 0; k < 5; k++)
                {
                    dst[0] = (byte)(dst[0] ^ buffer4[k]);
                    for (int m = 1; m < dst.Length; m++)
                    {
                        dst[m] = (byte)(((dst[m] ^ ((byte)(buffer4[k] << (m % 3)))) ^ dst[m - 1]) % 0x100);
                    }
                }
                buffer3 = dst;
            }
            byte[] array = byte_0;
            byte num6 = (byte)new Random().Next(0xff);
            Array.Resize<byte>(ref array, byte_0.Length + 1);
            array[array.Length - 1] = num6;
            for (int i = 0; i < (array.Length - 1); i++)
            {
                array[i] = (byte)((array[i] ^ buffer3[i]) ^ num6);
            }
            return array;
        }
        public static byte[] PolyDexDecrypt(byte[] plain, string Key)
        {
            byte[] key = Encoding.ASCII.GetBytes(Key);
            byte[] expandedKey;
            byte[] dKey = key;
            int length = plain.Length;
            if (dKey.Length >= length) expandedKey = dKey;
            else
            {
                byte[] rconst = BitConverter.GetBytes(Math.Round(Math.PI, 3));
                byte[] result = new byte[length];
                Buffer.BlockCopy(dKey, 0, result, 0, dKey.Length);
                for (int i = dKey.Length; i < length; i++)
                    result[i] = (byte)((dKey[(i - dKey.Length) % dKey.Length] ^ (result[i - 1])) % 256);
                for (int round = 0; round < 5; round++)
                {
                    result[0] = (byte)(result[0] ^ rconst[round]);
                    for (int i = 1; i < result.Length; i++)
                        result[i] = (byte)(((result[i] ^ (byte)(rconst[round] << (i % 3))) ^ result[i - 1]) % 256);
                }
                expandedKey = result;
            }
            byte[] wholeState = plain;
            byte magic = plain[plain.Length - 1];
            Array.Resize(ref wholeState, wholeState.Length - 1);
            for (int i = 0; i < wholeState.Length; i++) wholeState[i] = (byte)(wholeState[i] ^ magic ^ expandedKey[i]);
            return wholeState;
        }
Poly Stairs
Код:
public static byte[] PolyStairsEncrypt(byte[] byte_0, string string_0)

        {
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            Array.Resize<byte>(ref byte_0, byte_0.Length + 1);
            byte_0[byte_0.Length - 1] = Convert.ToByte(new Random().Next(1, 255));
            for (int i = byte_0.Length; i >= 0; i += -1)
            {
                byte_0[i % byte_0.Length] = Convert.ToByte((int)(Convert.ToByte(Convert.ToInt32((int)byte_0[i % byte_0.Length] + Convert.ToInt32(byte_0[(i + 1) % byte_0.Length])) % 256) ^ bytes[i % bytes.Length]));
            }
            return byte_0;
        }
        public static byte[] PolyStairDeCrypt(byte[] Data, string key)
        {
            byte[] Key = System.Text.Encoding.ASCII.GetBytes(key);
            for (int i = 0; i <= Data.Length; i++)
            {
                Data[i % Data.Length] = Convert.ToByte((Convert.ToInt32(Data[i % Data.Length] ^ Key[i % Key.Length]) - Convert.ToInt32(Data[(i + 1) % Data.Length]) + 256) % 256);
            }
            Array.Resize(ref Data, Data.Length - 1);
            return Data;
        }
Symetric
Код:
public static byte[] SymetricEncrypt(byte[] byte_0, string string_0)

        {
            SymmetricAlgorithm symmetricAlgorithm = SymmetricAlgorithm.Create();
            MemoryStream memoryStream = new MemoryStream();
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            byte[] rgbIV = bytes;
            CryptoStream cryptoStream = new CryptoStream(memoryStream, symmetricAlgorithm.CreateEncryptor(bytes, rgbIV), CryptoStreamMode.Write);
            cryptoStream.Write(byte_0, 0, byte_0.Length);
            cryptoStream.Close();
            return memoryStream.ToArray();
        }
        public static byte[] SymetricDecrypt(byte[] bytes, string Key)
        {
            MemoryStream ms = new MemoryStream();
            SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();
            byte[] key = Encoding.ASCII.GetBytes(Key);
            byte[] rgbIV = key;
            CryptoStream cs = new CryptoStream(ms, rijn.CreateDecryptor(key, rgbIV), CryptoStreamMode.Write);
            cs.Write(bytes, 0, bytes.Length);
            cs.Close();
            return ms.ToArray();
        }
+

AES
Код:
public static byte[] AESEncrypt(byte[] byte_0, string string_0)

        {
            RijndaelManaged rijndaelManaged = new RijndaelManaged();
            byte[] array = new byte[32];
            byte[] sourceArray = new MD5CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(string_0));
            Array.Copy(sourceArray, 0, array, 0, 16);
            Array.Copy(sourceArray, 0, array, 15, 16);
            rijndaelManaged.Key = array;
            rijndaelManaged.Mode = CipherMode.ECB;
            ICryptoTransform cryptoTransform = rijndaelManaged.CreateEncryptor();
            return cryptoTransform.TransformFinalBlock(byte_0, 0, byte_0.Length);
        }
        public static byte[] AESDecrypt(byte[] input, string Pass)
        {
            RijndaelManaged AES = new System.Security.Cryptography.RijndaelManaged();
            byte[] hash = new byte[32];
            byte[] temp = new MD5CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(Pass));
            Array.Copy(temp, 0, hash, 0, 16);
            Array.Copy(temp, 0, hash, 15, 16);
            AES.Key = hash;
            AES.Mode = System.Security.Cryptography.CipherMode.ECB;
            ICryptoTransform DESDecrypter = AES.CreateDecryptor();
            return DESDecrypter.TransformFinalBlock(input, 0, input.Length);
        }
Poly Baby
Код:
public static byte[] PolyBabyEncrypt(byte[] byte_0, string string_0)
        {
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            byte[] array = new byte[byte_0.Length + 1];
            int num = new Random().Next(1, 255);
            for (int i = 0; i <= byte_0.Length - 1; i++)
            {
                array[i] = (byte)((int)byte_0[i] ^ ((int)bytes[i % bytes.Length] + num & 255));
            }
            array[byte_0.Length] = (byte)num;
            return array;
        }
        public static byte[] PolyBabyDecrypt(byte[] input, string Key)
        {
            byte[] key = Encoding.ASCII.GetBytes(Key);
            byte[] Out = new byte[input.Length - 1];
            int x = input[input.Length - 1];
            for (int i = 0; i <= Out.Length - 1; i++) Out[i] = (byte)(input[i] ^ (key[i % key.Length] + x) & 255);
            return Out;
        }
DEX
Код:
public static byte[] DexEncrypt(byte[] byte_0, string string_0)

        {
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(string_0);
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < byte_0.Length; j++)
                {
                    byte_0[j] ^= bytes[j % bytes.Length];
                    for (int k = 0; k < bytes.Length; k++)
                    {
                        byte_0[j] = (byte)((int)byte_0[j] ^ ((int)((int)bytes[k] << (i & 31)) ^ k) + j);
                    }
                }
            }
            return byte_0;
        }
        public static byte[] DexDecrypt(byte[] plain, string Key)
        {
            byte[] key = System.Text.Encoding.ASCII.GetBytes(Key);
            for (int round = 4; round >= 0; round--)
            {
                for (int i = 0; i < plain.Length; i++)
                {
                    for (int k = 0; k < key.Length; k++) plain[i] = (byte)(plain[i] ^ ((((key[k] << round) ^ k) + i)));
                    plain[i] = (byte)(plain[i] ^ key[i % key.Length]);
                }
            }
            return plain;
        }
CLOUD
Код:
public static byte[] CloudEncrypt(byte[] byte_0, string string_0)
        {
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(string_0);
            byte[] array = new byte[byte_0.Length];
            short num = 0;
            for (int i = 0; i < byte_0.Length; i++)
            {
                if ((int)num >= bytes.Length)
                {
                    num = 0;
                }
                array[i] = (byte)((int)byte_0[i] + byte_0.Length % bytes.Length + (int)bytes[(int)num]);
                num += 1;
            }
            return array;
        }
        public static byte[] CloudDecrypt(byte[] Input, string key)
        {
            byte[] Key = System.Text.Encoding.ASCII.GetBytes(key);
            byte[] FinVal = new byte[Input.Length];
            short kc = 0;
            for (int index = 0; index < Input.Length; index++)
            {
                if (kc >= Key.Length) kc = 0;
                FinVal[index] = (byte)(Input[index] - (Input.Length % Key.Length) - (Key[kc]));
                kc++;
            }
            return FinVal;
        }
Poly AES
Код:
public static byte[] PolyAESencrypt(byte[] byte_0, string string_0)

        {
            System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm = new System.Security.Cryptography.RijndaelManaged();
            System.Security.Cryptography.RNGCryptoServiceProvider rNGCryptoServiceProvider = new System.Security.Cryptography.RNGCryptoServiceProvider();
            symmetricAlgorithm.Mode = System.Security.Cryptography.CipherMode.CBC;
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(string_0);
            symmetricAlgorithm.GenerateIV();
            byte[] array = new byte[32];
            rNGCryptoServiceProvider.GetBytes(array);
            System.Security.Cryptography.Rfc2898DeriveBytes rfc2898DeriveBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(bytes, array, 2000);
            symmetricAlgorithm.Key = rfc2898DeriveBytes.GetBytes(32);
            System.Security.Cryptography.ICryptoTransform cryptoTransform = symmetricAlgorithm.CreateEncryptor();
            byte[] array2 = cryptoTransform.TransformFinalBlock(byte_0, 0, byte_0.Length);
            int dstOffset = array2.Length;
            System.Array.Resize<byte>(ref array2, array2.Length + array.Length);
            System.Buffer.BlockCopy(array, 0, array2, dstOffset, array.Length);
            dstOffset = array2.Length;
            System.Array.Resize<byte>(ref array2, array2.Length + symmetricAlgorithm.IV.Length);
            System.Buffer.BlockCopy(symmetricAlgorithm.IV, 0, array2, dstOffset, symmetricAlgorithm.IV.Length);
            return array2;
        }
        public static byte[] PolyAESDecrypt(byte[] cipherText, string Key)
        {
            byte[] salt;
            SymmetricAlgorithm algo = new RijndaelManaged();
            algo.Mode = CipherMode.CBC;
            RNGCryptoServiceProvider rngAlgo = new RNGCryptoServiceProvider();
            byte[] key = System.Text.Encoding.ASCII.GetBytes(Key);
            byte[] cipherTextWithSalt = new byte[1];
            byte[] encSalt = new byte[1];
            byte[] origCipherText = new byte[1];
            byte[] encIv = new byte[1];
            Array.Resize(ref encIv, 16);
            Buffer.BlockCopy(cipherText, (int)(cipherText.Length - 16), encIv, 0, 16);
            Array.Resize(ref cipherTextWithSalt, (int)(cipherText.Length - 16));
            Buffer.BlockCopy(cipherText, 0, cipherTextWithSalt, 0, (int)(cipherText.Length - 16));
            Array.Resize(ref encSalt, 32);
            Buffer.BlockCopy(cipherTextWithSalt, (int)(cipherTextWithSalt.Length - 32), encSalt, 0, 32);
            Array.Resize(ref origCipherText, (int)(cipherTextWithSalt.Length - 32));
            Buffer.BlockCopy(cipherTextWithSalt, 0, origCipherText, 0, (int)(cipherTextWithSalt.Length - 32));
            algo.IV = encIv;
            salt = encSalt;
            Rfc2898DeriveBytes pwDeriveAlg = new Rfc2898DeriveBytes(key, salt, 2000);
            algo.Key = pwDeriveAlg.GetBytes(32);
            ICryptoTransform decTransform = algo.CreateDecryptor();
            byte[] plainText = decTransform.TransformFinalBlock(origCipherText, 0, origCipherText.Length);
            return plainText;
        }
Stairs
Код:
public static byte[] StairsEncrypt(byte[] byte_0, string string_0)

        {
            byte[] bytes = Encoding.ASCII.GetBytes(string_0);
            for (int i = 0; i <= ((byte_0.Length * 2) + bytes.Length); i++)
            {
                byte_0[i % byte_0.Length] = (byte)(((byte)((byte_0[i % byte_0.Length] + byte_0[(i + 1) % byte_0.Length]) % 0x100)) ^ bytes[i % bytes.Length]);
            }
            return byte_0;
        }
        public static byte[] StairsDecrypt(byte[] Data, string Key)
        {
            byte[] key = System.Text.Encoding.ASCII.GetBytes(Key);
            for (int i = (Data.Length * 2) + key.Length; i >= 0; i += -1)
            {
                Data[i % Data.Length] = (byte)(((int)(Data[i % Data.Length] ^ key[i % key.Length]) - (int)(Data[(i + 1) % Data.Length]) + 256) % 256);
            }
            return Data;
        }
Poly 3DES
Код:
public static byte[] Poly3desEncrypt(byte[] byte_0, string string_0)

        {
            byte[] array = byte_0;
            System.Array.Resize<byte>(ref array, array.Length + 1);
            array[array.Length - 1] = (byte)new System.Random().Next(0, 255);
            System.Security.Cryptography.TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new System.Security.Cryptography.TripleDESCryptoServiceProvider();
            tripleDESCryptoServiceProvider.Key = System.Text.Encoding.UTF8.GetBytes(string_0);
            tripleDESCryptoServiceProvider.Mode = System.Security.Cryptography.CipherMode.ECB;
            tripleDESCryptoServiceProvider.Padding = System.Security.Cryptography.PaddingMode.PKCS7;
            System.Security.Cryptography.ICryptoTransform cryptoTransform = tripleDESCryptoServiceProvider.CreateEncryptor();
            byte[] result = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
            tripleDESCryptoServiceProvider.Clear();
            return result;
        }
        public static byte[] PolyTripleDESDecrypt(byte[] bytes, string Key)
        {
            byte[] inputArray = bytes;
            TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
            tripleDES.Key = UTF8Encoding.UTF8.GetBytes(Key);
            tripleDES.Mode = CipherMode.ECB;
            tripleDES.Padding = PaddingMode.PKCS7;
            ICryptoTransform cTransform = tripleDES.CreateDecryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
            tripleDES.Clear();
            Array.Resize(ref resultArray, resultArray.Length - 1);
            return resultArray;
        }
Poly DES
Код:
public static byte[] PolyDesEncrypt(byte[] byte_0, string string_0)
        {
            byte[] array = byte_0;
            System.Array.Resize<byte>(ref array, array.Length + 1);
            array[array.Length - 1] = (byte)new System.Random().Next(0, 255);
            System.Security.Cryptography.DESCryptoServiceProvider dESCryptoServiceProvider = new System.Security.Cryptography.DESCryptoServiceProvider();
            dESCryptoServiceProvider.Key = System.Text.Encoding.UTF8.GetBytes(string_0);
            dESCryptoServiceProvider.Mode = System.Security.Cryptography.CipherMode.ECB;
            dESCryptoServiceProvider.Padding = System.Security.Cryptography.PaddingMode.PKCS7;
            System.Security.Cryptography.ICryptoTransform cryptoTransform = dESCryptoServiceProvider.CreateEncryptor();
            byte[] result = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
            dESCryptoServiceProvider.Clear();
            return result;
        }
        public static byte[] PolyDESDecrypt(byte[] bytes, string Key)
        {
            byte[] inputArray = bytes;
            DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
            DES.Key = UTF8Encoding.UTF8.GetBytes(Key);
            DES.Mode = CipherMode.ECB;
            DES.Padding = PaddingMode.PKCS7;
            ICryptoTransform cTransform = DES.CreateDecryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
            DES.Clear();
            Array.Resize(ref resultArray, resultArray.Length - 1);
            return resultArray;
        }
Poly RijnDael
Код:
public static byte[] PolyRijnDaelEncrypt(byte[] byte_0, string string_0)
        {
            System.Array.Resize<byte>(ref byte_0, byte_0.Length + 1);
            byte_0[byte_0.Length - 1] = (byte)new System.Random().Next(0, 255);
            System.Security.Cryptography.Rijndael rijndael = System.Security.Cryptography.Rijndael.Create();
            System.Security.Cryptography.Rfc2898DeriveBytes rfc2898DeriveBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(string_0, new byte[]
           {
               38,
               220,
               255,
               0,
               173,
               237,
               122,
               238,
               197,
               254,
               7,
               175,
               77,
               8,
               34,
               60
           });
            rijndael.Key = rfc2898DeriveBytes.GetBytes(32);
            rijndael.IV = rfc2898DeriveBytes.GetBytes(16);
            System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
            System.Security.Cryptography.CryptoStream cryptoStream = new System.Security.Cryptography.CryptoStream(memoryStream, rijndael.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
            cryptoStream.Write(byte_0, 0, byte_0.Length);
            cryptoStream.Close();
            return memoryStream.ToArray();
        }
        public static byte[] PolyRijndaelDecrypt(byte[] bytes, string Key)
        {
            Rijndael rijndael = Rijndael.Create();
            Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(Key,
                new byte[] { 0x26, 0xdc, 0xff, 0x00, 0xad, 0xed, 0x7a, 0xee, 0xc5, 0xfe, 0x07, 0xaf, 0x4d, 0x08, 0x22, 0x3c });
            rijndael.Key = pdb.GetBytes(32);
            rijndael.IV = pdb.GetBytes(16);
            MemoryStream memoryStream = new MemoryStream();
            CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndael.CreateDecryptor(), CryptoStreamMode.Write);
            cryptoStream.Write(bytes, 0, bytes.Length);
            cryptoStream.Close();
            byte[] b = memoryStream.ToArray();
            Array.Resize(ref b, b.Length - 1);
            return b;
        }
Poly Cloud
Код:
public static byte[] PolyCloudEncrypt(byte[] byte_0, string string_0)
        {
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(string_0);
            System.Random random = new System.Random();
            int num = random.Next(1, 50);
            byte[] array = new byte[byte_0.Length + 1];
            array[byte_0.Length] = (byte)num;
            short num2 = 0;
            for (int i = 0; i < byte_0.Length; i++)
            {
                if ((int)num2 >= bytes.Length)
                {
                    num2 = 0;
                }
                array[i] = (byte)((int)byte_0[i] + byte_0.Length % bytes.Length + (int)bytes[(int)num2] - num);
                num2 += 1;
            }
            return array;
        }
        public static byte[] PolyCloudDecrypt(byte[] Input, string key)
        {
            byte[] Key = System.Text.Encoding.ASCII.GetBytes(key);
            int Salt = (int)Input[Input.Length - 1];
            byte[] FinVal = new byte[Input.Length - 1];
            short kc = 0;
            for (int index = 0; index < Input.Length - 1; index++)
            {
                if (kc >= Key.Length) kc = 0;
                if (index >= Input.Length - 1) continue;
                FinVal[index] = (byte)(Input[index] - (FinVal.Length % Key.Length) - (Key[kc]) + Salt);
                kc++;
            }
            return FinVal;
        }




 

HHIDE_DUMP

Гость
H

HHIDE_DUMP

Гость
Буду пробовать. Спасибо
 

О нас

  • Наше сообщество существует уже много лет и гордится тем, что предлагает непредвзятое, критическое обсуждение различных тем среди людей разных слоев общества. Мы работаем каждый день, чтобы убедиться, что наше сообщество является одним из лучших.

    Dark-Time 2015 - 2024

    При поддержке: XenForo.Info

Быстрая навигация

Меню пользователя