2 Replies - 1727 Views - Last Post: 06 September 2010 - 08:30 AM Rate Topic: -----

#1 TheWiz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-September 10

The Caesar encryption of a file in C#.NET 2008

Posted 06 September 2010 - 08:13 AM

How do I encrypt/decrypt a file using the Caesar shift in C#.NET 2008
Is This A Good Question/Topic? 0
  • +

Replies To: The Caesar encryption of a file in C#.NET 2008

#2 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: The Caesar encryption of a file in C#.NET 2008

Posted 06 September 2010 - 08:21 AM

A very simple way to do it would be to create a Dictionary<char,char>() and have each letter represent another letter. The Key would be the encrypted character, the Value would be the actual letter being encrypted. Then you could just use that dictionary:

public char Convert(char character)
{
    return CaesarConverter.Convert(character);
}


The convert method above would be:

return MyDictionary[character];




NOT TESTED. But you get the idea.
Was This Post Helpful? 1
  • +
  • -

#3 TheWiz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-September 10

Re: The Caesar encryption of a file in C#.NET 2008

Posted 06 September 2010 - 08:30 AM

``
Thanks, Sergio!

This post has been edited by JackOfAllTrades: 06 September 2010 - 08:40 AM
Reason for edit:: Removed unnecessary quote

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1