Encrypt/Decrypt password: differenze tra le versioni
Da Webmobili Wiki.
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
| Riga 11: | Riga 11: | ||
) | ) | ||
INSERT INTO @tempCustomer VALUES ('utente- | INSERT INTO @tempCustomer VALUES ('utente-nome',ENCRYPTBYPASSPHRASE(N'culo-sale-culo-scende', N'nel mezzo di una matita mi ritrovai un culo di mezzo')) | ||
select * from @tempCustomer | select * from @tempCustomer | ||
Versione delle 15:23, 5 apr 2022
Usiamo due funzioni standard di SQL Server:
- ENCRYPTBYPASSPHRASE([Stringa per il sale],[password in chiaro])
- DECRYPTBYPASSPHRASE([Stringa per il sale],[password cifrata])
Esempio
DECLARE @tempCustomer table (
[UserName] VARCHAR(50),
[Password] VARBINARY(1000)
)
INSERT INTO @tempCustomer VALUES ('utente-nome',ENCRYPTBYPASSPHRASE(N'culo-sale-culo-scende', N'nel mezzo di una matita mi ritrovai un culo di mezzo'))
select * from @tempCustomer
SELECT [UserName], CONVERT (nvarchar(1000), DECRYPTBYPASSPHRASE(N'culo-sale-culo-scende',[Password]))
from @tempCustomer