Encryption iv

static void Main(string[] args) { 

   string charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
   
   string decriptString = "FDYMHQDCFIDJBIPWDKR"; 
   
   int indexOfInput; 

   string orginal = ""; 
  
   int invers = 1; 

   int temp = 0; 

  while (temp != 1) {
     temp = (7 * invers) % 26; 
     invers++;
  }

  invers -= 1; 
  Console.WriteLine("Invers of 7 : "+invers);

  for (int i = 0; i < decriptString.Length; i++) {
     
     indexOfInput = charSet.IndexOf(decriptString[i]);
     
     int point = invers * (indexOfInput - 3) % 26;
    
     if (point < 0) {
              point = (point + charSet.Length);
     }
     
     orginal += charSet[point]; 
 }

  Console.WriteLine("Orginal Text : "+orginal); Console.ReadLine(); 
 }

No comments:

Post a Comment