請問為什麼TYPE跟TYPE2加密後的結果會不一樣?
我想要TYPE2出來的結果跟TYPE一樣
DECLARE @Password nvarchar(128),
@TYPE nvarchar(128),
@TYPE2 nvarchar(128)
SET @Password = '123456'
SET @TYPE = (SELECT lower(CONVERT(varchar(max), HASHBYTES ('SHA2_512','123456') ,2)))
SET @TYPE2 = (SELECT lower(CONVERT(varchar(max), HASHBYTES ('SHA2_512',@Password) ,2)))
select @Password as 密碼, @TYPE as TYPE,@TYPE2 as TYPE2
DECLARE @Password varchar(128),
@TYPE nvarchar(128),
@TYPE2 nvarchar(128)
SET @Password = '123456'
SET @TYPE = (SELECT lower(CONVERT(varchar(max), HASHBYTES ('SHA2_512','123456') ,2)))
SET @TYPE2 = (SELECT lower(CONVERT(varchar(max), HASHBYTES ('SHA2_512',@Password) ,2)))
select @Password as 密碼, @TYPE as TYPE,@TYPE2 as TYPE2
將@Password 型態改為 varchar即可
但詳細原因我也還不確定