Search

Simple Encryption

This program displays a simple basic encryption using c#. This encryption is being used in a virus called VBSRedlof.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace RedOF
{
class Program
{
public static string key;
public static int[] KeyArr = { 4,8,7,8};//4037//4878//7835
static void Main(string[] args)
{

Console.WriteLine("VCode ");
keygen();
WRITEKey();
string ans;
ans = @"Love the way you lie";
//ans= Console.ReadLine();
//Console.WriteLine("\n \nREDOF{0}: {1}",key,Encode(ans).ToUpper());
string qus = Encode(ans) + ":" + "RDF" + key;
Console.WriteLine(qus);
//Console.WriteLine("GOTKEY:{0}",GETKey(qus));
Console.WriteLine("{0}", Decode(qus));

//Encode("ggggg");
Console.Read();
}

//prints anything
static void prn(Object o)
{
Console.WriteLine(o);
}

//Gets the key from chipertext
static string GETKey(string chiper)
{
char[] hh = { '1', '2', '3', ' ' };
Console.WriteLine("Signature Index....{0}",chiper.IndexOf(":RDF", 1));
chiper.CopyTo(chiper.IndexOf(":RDF",1)+4, hh, 0, 4);
string res=null;
//Console.WriteLine("{0}{1}{2}{3}", hh[0], hh[1], hh[2], hh[3]);
foreach (char cc in hh)
res = res + cc;
return res;
}

//Writes the Key to the file
static void WRITEKey()
{
Console.Write("KEY:");
foreach (int t in KeyArr)
{
Console.Write(t);
key = key + t;
}
Console.Write("\n");
}

//Generated Random Key
static void keygen()
{
int rr;
Random rnd = new Random();
for (int i = 0; i < 3; i++)
{
rr = rnd.Next(1, 9);
KeyArr[i] = rr;
}
}

// Encodes the Plaintext
static string Encode(string plaintxt)
{
int tempnum,asc,i=0;
string tempchar=null;

foreach(char ch in plaintxt)
{
i++;
tempnum = Convert.ToInt32(ch);
asc = Convert.ToInt32(KeyArr[i % 4]) + tempnum;
tempchar = tempchar + Convert.ToChar(asc);
}
return tempchar;
}

//Decode.....
static string Decode(string chipertext)
{
int tempnum, asc, i = 0;
string tempchar = null;

foreach (char ch in chipertext)
{
if (i >=chipertext.Length-8)
{
i++;
}
else
{
i++;
tempnum = Convert.ToInt32(ch);
asc = tempnum - KeyArr[i % 4];
tempchar = tempchar + Convert.ToChar(asc);
}
}
return tempchar;
}
}
}