Difference between java.util.Random and java.security.SecureRandom

My team got handed over some server side code (in Java) that generates random tokens and I have a question regarding the same – The purpose of these tokens is fairly sensitive – used for session id, password reset links etc. So they do need to be cryptographically random to avoid somebody guessing them or … Read more

How does password salt help against a rainbow table attack?

I’m having some trouble understanding the purpose of a salt to a password. It’s my understanding that the primary use is to hamper a rainbow table attack. However, the methods I’ve seen to implement this don’t seem to really make the problem harder. I’ve seen many tutorials suggesting that the salt be used as the … Read more

How do you Encrypt and Decrypt a PHP String?

What I mean is: Original String + Salt or Key –> Encrypted String Encrypted String + Salt or Key –> Decrypted (Original String) Maybe something like: “hello world!” + “ABCD1234” –> Encrypt –> “2a2ffa8f13220befbe30819047e23b2c” (may be, for e.g) “2a2ffa8f13220befbe30819047e23b2c” –> Decrypt with “ABCD1234” –> “hello world!” In PHP, how can you do this? Attempted to … Read more

Where do you store your salt strings?

I’ve always used a proper per-entry salt string when hashing passwords for database storage. For my needs, storing the salt in the DB next to the hashed password has always worked fine. However, some people recommend that the salt be stored separately from the database. Their argument is that if the database is compromised, an … Read more

What data type to use for hashed password field and what length?

I’m not sure how password hashing works (will be implementing it later), but need to create database schema now. I’m thinking of limiting passwords to 4-20 characters, but as I understand after encrypting hash string will be of different length. So, how to store these passwords in the database? 10 Answers 10

Failed to install Python Cryptography package with PIP and setup.py

When I try to install the Cryptography package for Python through either pip install cryptography or by downloading the package from their site and running python setup.py, I get the following error: D:\Anaconda\Scripts\pip-script.py run on 02/27/14 16:13:17 Downloading/unpacking cryptography Getting page https://pypi.python.org/simple/cryptography/ URLs to search for versions for cryptography: * https://pypi.python.org/simple/cryptography/ Analyzing links from page … Read more