1

which algorithm is better for encrypt and decrypt data inside a project?
i designed and developed a site like below :
htttp://www.soscharge.com

this site is about mobile charge codes ...

i want to encrypt mobile charge codes during insert to database and decrypt them for showing to users...

hash algorithm is not a good idea about this purpose (one way algorithm)

i heard something about symmetric and asymmetric algorithms (but i want to learn how can i write a simple and powerfull algorithm by myself)

thanks in advance

SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • By encode do you mean encrypt? Encode has an entirely different meaning. – iandotkelly Aug 24 '11 at 13:13
  • You should probably look into http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net – Prisoner ZERO Aug 24 '11 at 13:16
  • @iandotkelly : i Edit My Q / Sorry – SilverLight Aug 24 '11 at 13:19
  • 3
    Best not write an encryption algorithm yourself. No offense, but anything you or I can come up with will be much less secure than the existing standards. – Mr47 Aug 24 '11 at 13:21
  • 3
    I think you may mean symmetric and asymmetric, not syncrhonous and asynchronous. You should definitely *not* write your own encryption code - use the algorithms in the framework. Encryption is best left to the experts. – Jon Skeet Aug 24 '11 at 13:22
  • No problem. I think you may also mean symmetrical and asymmetrical algorithms too, not (a)synchronous. For what you are talking about, you want a symmetrical algorithm -you have one private key in your software - you encrypt and decrypt with the one key. Other than that, I would use a library, and don't know enough to recommend one to code yourself. It is a field fraught with dangers for the amateur to tackle - one mistake can make your encryption useless, and you probably wouldn't realize it. – iandotkelly Aug 24 '11 at 13:25

3 Answers3

4

never - NEVER write your encryption-algorithms yourself if you are not an expert and get paid for it! Seriously: you will never get a good and secure algorithm working just by yourself. Use the tools in the Framework - System.Security.Cryptography namespace! And you don't ask for synchronous vs. asynchronous but I guess you are thinking on symmetric vs. assymetric algorithms

now to the answer: as you have full controll of your database and an outsider should not be able to get to it you can use symmetric key algorithms because you protect your "secret" (the key) on your system and the user will never see it (or so it should be - if your system is secure can only a IT-guy tell you)

Random Dev
  • 51,810
  • 9
  • 92
  • 119
1

which algorithm is better for encrypt and decrypt data inside a project?

You didn't give us any criteria on which to evaluate "better."

Frankly, it sounds like you're not a security expert. This stuff is so easy to get wrong, even if you pick the "best" algorithm (look at the recent RSA debacle). If you have secrets that truly need to be safeguarded, you should hire a security expert. Your stakeholders will thank you later.

(but i want to learn how can i write a simple and powerfull algorithm by myself)

Take a course. Read a book (or two; the Bruce Schneier books are decent). Practice for about 10,000 hours.

i heard something about synchronous and asynchronous algorithms

Symmetric and asymmetric, perhaps? I mean, this tells us all we need to know about your level of expertise on this subject.

Seriously, don't do this yourself. Get an expert to help you.

jason
  • 236,483
  • 35
  • 423
  • 525
0

I assume that you need symmetric algo, by now best choice is AES. It's easy, strong and has implementations for most platforms and languages.

umbr
  • 440
  • 2
  • 4