Click here to Skip to main content
14,878,631 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to encrypt the password in sql so that it appears as "*****" in the database table

What I have tried:

CREATE TABLE [dbo].[Autoryzacja] (
    [Id]       INT           IDENTITY (1, 1) NOT NULL,
    [login]    NVARCHAR (50) NULL,
    [password]    NVARCHAR (50) NULL,
    [imie]     NVARCHAR (50) NULL,
    [nazwisko] NVARCHAR (50) NULL,
    [email]    NVARCHAR (50) NULL,
Updated 13-Dec-20 0:29am
Maciej Los 13-Dec-20 6:24am
Do not store passwords as a plain text! Using [*] stars is not an option.

You can't.
Databases don't "know" that a column is sensitive information - they just store the data you give them. To "hide" a column with stars would mean the column text would have to be all stars, and that's not useful.

The solution is simple: Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^]

And remember: if you have any European Union users then GDPR applies and that means you need to handle passwords as sensitive data and store them in a safe and secure manner. Text is neither of those and the fines can be .... um ... outstanding. In December 2018 a German company received a relatively low fine of €20,000 for just that.
Jörgen Andersson 14-Dec-20 4:20am
Well, actually you can. But since that's the wrong answer for this purpose, I won't submit a link on how to do it. :)
I'd strongly recommend to read this: Password Storage: How to do it.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900