- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How should I store data into my Mysql database, what type should I assign to a column storing salt values?
Salt is used to store your data securely. If we have to store user password securely, we need to use salt.
$pwd=hash(hash($password) + salt)
then store $pwd in your system instead of the real password.
So, the question is, how to define the salt value. Here is how:
// if (saltBytes == null) { // Define min and max salt sizes. int minSaltSize = 4; int maxSaltSize = 8; // Generate a random number for the size of the salt. Random random = new Random(); int saltSize = random.Next(minSaltSize, maxSaltSize); // Allocate a byte array, which will hold the salt. saltBytes = new byte[saltSize]; // Initialize a random number generator. RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); // Fill the salt with cryptographically strong byte values. rng.GetNonZeroBytes(saltBytes); }
- Related Articles
- Best data type for storing currency values in a MySQL database?
- How should I manage my life?
- Should I include type=“text/javascript” in my SCRIPT tags?
- Why should we not store a number into a MySQL ENUM column?
- My girlfriend never appreciates me, what should I do?
- How should I display MySQL database that is currently in use?
- Which one should I use? The datetime or timestamp data type in MySQL?
- Being a girl should I give importance to my looks?
- What Should I Do If My IP Address Is Exposed?
- How do I add more members to my ENUM - type column in MySQL?
- Should I store a field PRICE as an int or as a float in the database?
- How to concatenate two column values into a single column with MySQL. The resultant column values should be separated by hyphen
- How MySQL evaluates if I store date along with time value in a column having DATE data type?
- What should I do if someone copies my website/blog content?
- Should I include language="javascript" in my SCRIPT tags?

Advertisements