• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cryptography vs security

 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I did sample programs in cipher,md5 and sha.
But i dont know which is best in terms of security.
Kindly let me know which one is good to use and reason for the same.
You can add other algorithm also but i wanna know the secure one.

1)cipher cryptography
2)MD5
3)SHA.

Thanks in advance.

Regards,
Sriram.V
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MD5 and SHA are cryptographic hash functions. Note, that page contains a list of different algorithms, including some MD5 and SHA variants. I'm not an expert in this, but as far as I know SHA is more secure than MD5.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The important point to realize is that ciphers offer two-way encryption. That means if you encrypt something you can later decrypt it, thus getting back the original cleartext. AES is a good standard choice for encryption.

MD5 and SHA are both hashes (or digests) which implement one-way encryption. Once something is hashed there is no way to get back the original cleartext (there's no decryption). MD5 should be considered obsolete at this point, as should SHA-1; that leaves SHA-2 as the standard choice.

The http://www.coderanch.com/how-to/java/SecurityFaq#encryption links to much more information on this, as well as JCE, the standard Java API for encryption.
 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jesper and ulf thanks for your effort.
Shall i take like this in terms of security sha or md5 is more security compared to cipher.
Because cipher shows the original string after decryption.

Regards,
Sriram.V
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sri ramvaithiyanathan wrote:jesper and ulf thanks for your effort.
Shall i take like this in terms of security sha or md5 is more security compared to cipher.
Because cipher shows the original string after decryption.


The context and detail of what you are doing is everything. If you are trying to secure user passwords when one does not need to be able to recover the password then using a message digest with random salt is usually the most secure. If one is trying to secure data that one needs to be able to recover then obviously one can't uses a message digest (since you can't recover the original) and one need to use encryption.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic