开发者

Personal encoding/decoding program

开发者 https://www.devze.com 2023-02-20 05:16 出处:网络
I\'m working on a project, and am hoping I might be able to get some help with it: Pretty much, it\'s a program that encodes characters (the English alphabet, and punctuation) into a personalized cod

I'm working on a project, and am hoping I might be able to get some help with it:

Pretty much, it's a program that encodes characters (the English alphabet, and punctuation) into a personalized code. So pretty much (input: a, output: an int).. It will also be able to decode the files which it has encoded. I am making it as a wpf program, using visual studio 2010, and coding it in C#.

I want the program to use the contents of a xml file as its encoding/decoding logic. So I'm guessing I'll have the file hold different values for each character (This part is still in the thought process)..

What I need to figure out: If the user loads a text file in English, into the program, how can I make it encode it using the information from the xml file; and vise versa for decoding. And then output to a new text file.

I know how to do basic stream writing/reading, and xml serialization. I think the main problem right now is making the program use the deserialized 开发者_开发百科information from the xml file..

Anyway, thank you for reading through all this :) if you have any ideas, please do share.


I assume by the mean of personalized code, you meant that you want it to be encrypted.

In a basic encryption algo design, there are few components you need to consider.

Key - you are taking the content of your XML file as the key for encrypting/decrypting Plaintext - your input : a Algorithm - this is the one you are missing

So, all you need to do is to find a way to use the Key to change your Plaintext into another format (ciphertext)

For example, you can mix the xml content with your Plaintext

Index            12345123451
ie.in your XML : ABCDE
your Plaintext : I am James.

Then you can operate on them character by character.

1 - A - I
2 - B -" "
3 - C - a
....

Beyond the basics, you should also think about whether you want to operate as stream or block algorithm, how security you want it to be, whether you use the same key for encrypt/decrypt etc... in general, its not easy to come up with a good algo, you can make use of currently available ones easily.

0

精彩评论

暂无评论...
验证码 换一张
取 消