Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 what DataType to store a hashpassword in

I am currently building a login process and decided to store my user password in database with a hashpassword combined with a salt. Just wondering what datatypes to store the hashpassword and salt is Varchar or NVarchar sufficient ?

EDIT : Link where I am basing this on storing passwords in SQL Server

like image 490
StevieB Avatar asked Nov 24 '25 23:11

StevieB


2 Answers

Microsoft use Nvarchar in when we use SQL membership, have a look the below image

enter image description here

like image 77
Muhammad Akhtar Avatar answered Nov 27 '25 15:11

Muhammad Akhtar


The hash of your passwords should be of uniform string length and represented as either hex or base64 text (or some other, single-byte-per-character representation.)

EDIT (You just need the char type per the uniform length of hash output!)

So char will suffice.

like image 40
Paul Sasik Avatar answered Nov 27 '25 14:11

Paul Sasik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!