Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP
hy!
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
msz900445
Comments
ThePhantomUpvoter at 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
good
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[^]
AES[^]
DES[^]
RC2[^]
Rijndael[^]
TripleDES[^]
 
Asymmetric algorithms[^]
DSA[^]
ECDiffieHellman[^]
ECDsa[^]
RSA[^]
 
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.
  Permalink  
Comments
Nelek at 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 at 30-Apr-14 17:49pm
   
Yes, I've seen that after posting.
Maybe it could be useful for someone else :)
Nelek at 2-May-14 13:23pm
   
I think so, that's why I gave my 5
Rate this: bad
good
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:
http://www.youtube.com/watch?v=njNPgMmghMo[^]
 
He has a lot more lectures on crytography so just watch them and youll find out Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

MD5, SHA1 and SHA2 are hash functions not encryption algorithms : http://en.wikipedia.org/wiki/MD5[^]
  Permalink  
Comments
msz900 at 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 at 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 at 28-Apr-13 14:30pm
   
Absolutely right encryption has to be reversible by definition.
msz900 at 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
good
Please Sign up or sign in to vote.

Solution 3

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

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

  Print Answers RSS
0 Richard MacCutchan 269
1 Aajmot Sk 252
2 Marcin Kozub 235
3 Sergey Alexandrovich Kryukov 185
4 Praneet Nadkar 167
0 OriginalGriff 7,913
1 Sergey Alexandrovich Kryukov 7,232
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 30 Apr 2014
Copyright © CodeProject, 1999-2014
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