Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library for passwords (salt/hash) in C?

Tags:

c

passwords

hash

Does anyone know of a library or framework to salt and hash a password in C? How would I go about doing this in a program?

like image 376
Groppe Avatar asked Apr 23 '12 00:04

Groppe


People also ask

What is salted password hashing?

Salting is simply the addition of a unique, random string of characters known only to the site to each password before it is hashed, typically this “salt” is placed in front of each password. The salt value needs to be stored by the site, which means sometimes sites use the same salt for every password.

Where are password salts stored?

The easiest way is to put the salt in front of the password and hash the combined text string. The salt is not an encryption key, so it can be stored in the password database along with the username – it serves merely to prevent two users with the same password getting the same hash.

Which hashing algorithm is used for passwords?

Commonly used hashing algorithms include Message Digest (MDx) algorithms, such as MD5, and Secure Hash Algorithms (SHA), such as SHA-1 and the SHA-2 family that includes the widely used SHA-256 algorithm.

Can salted passwords be cracked?

As you can see from the above example it is possible to crack passwords that use salts. It just takes much longer and requires more processing time. Hashed passwords that use salts are what most modern authentication systems use.


1 Answers

I would definitely go with OpenSSL. Please, when it comes to encryption, don't try and roll your own, or just find something someone posted on the Internet. Go with something like OpenSSL that is verified, and trusted by millions every day. Home-brew and improperly implemented encryption is in my opinion a leading cause of security breaches on the Internet.

As Tibor mentioned, a salt is typically appended to the password before hashing. A unique salt greatly decreases the ability of a rainbow table based attack.

like image 166
Jonathon Reinhart Avatar answered Sep 27 '22 22:09

Jonathon Reinhart