Click here to Skip to main content
11,921,835 members (65,811 online)
Rate this:
Please Sign up or sign in to vote.
See more: PHP
can any one tell me which is the best/latest and secure algorithm for encryption.
As for my i select the SHA-2...
what will be your's choise?
1) MD5
2) SHA-1
3) SHA-2
if any other then please tell....
Your opinion is necessary for me....
Posted 28-Apr-13 9:18am
ThePhantomUpvoter 28-Apr-13 14:22pm
If you are looking for a hashing algorithm then I would probably pick SHA-2. Certainly not MD5. If I were looking for an encryption algorithm, I would pick none of the above.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

'Best' has to be defined regarding an encryption algorithm (you seem to confound hashing and encryption, but Mehdi Gholam already told you that in Solution 2). The best algorithm should the one which shows the greatest ratio between provided security and used resources.
For general use, a simple symmetric encryption, like TripleDES, should be sufficient. If security is a bigger concern, like banks for example, then an asymmetric encryption algorithm could be more appropriate, like RSA for example. But asymmetric algorithms are a little bit more complex to use, and need also more resources from the computer.
Below I summarized you some cryptographic algorithms that exist and are implemented in .NET Framework, along with some link for them so that you can go and make your own choice:

Symmetric algorithms[^]

Asymmetric algorithms[^]

Not knowing your concrete requirement, it is hard to tell whether you need to hash or to encrypt.
The only thing I can say is, if you are willing to encrypt your users passwords in your database, then you're wrong: you need to store a hash of the password.
This post[^] is very informative about best practices for passwords-handling.

I know this is a lot of reading, but security is not a trivial subject, and you should not attempt to use it without understanding its very basics. Hope this helps. Good luck.
Nelek 30-Apr-14 16:42pm
Nice answer, a bit late but still nice :P

OP answered himself (and self accepted) one year too late.
phil.o 30-Apr-14 17:49pm
Yes, I've seen that after posting.
Maybe it could be useful for someone else :)
Nelek 2-May-14 13:23pm
I think so, that's why I gave my 5
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Most of the small hardware devices uses elliptivc curves for cryptation, as it is the most secure with the least amount of bytes. You could check out this:[^]

He has a lot more lectures on crytography so just watch them and youll find out Smile | :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

MD5, SHA1 and SHA2 are hash functions not encryption algorithms :[^]
msz900 28-Apr-13 14:26pm
i agree with you that MD5,SHA_1,SHA_2 are hashing algorithm but we use one of these to encrypt the user input data before storing it in Mysql.
ThePhantomUpvoter 28-Apr-13 14:28pm
No... you are using those algorithms to hash the user input. That is not the same as encryption. Encryption you can reverse, a hash you cannot.
Mehdi Gholam 28-Apr-13 14:30pm
Absolutely right encryption has to be reversible by definition.
msz900 28-Apr-13 14:33pm
if it is, then what type of encryption method you suggest for me.
iam working in PHP and using PDO to interact with Mysql.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

this best hashing algorithm in php 4 is the
and in php 5.5 is it,s own hashing function...
password_hash()  and password_verify().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 538
1 Dave Kreskowiak 260
2 Sergey Alexandrovich Kryukov 173
3 phil.o 170
4 RyanDev 134
0 OriginalGriff 7,036
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,286
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 30 Apr 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100