2011-02-03 78 views

回答

0

MySQL有一個SHA1功能:

mysql> SELECT SHA1('password'); 
+------------------------------------------+ 
| SHA1('password')       | 
+------------------------------------------+ 
| 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 | 
+------------------------------------------+ 

什麼是等價的SQL Server功能產生?

+1

`DECLARE @HashThis nvarchar(MAX); SELECT @HashThis ='password'; SELECT HashBytes('SHA1',@HashThis); ` 回報0xE8F97FBA9104D1EA5047948E6DFB67FACD9F5B73比5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 – 2011-03-26 00:52:30

2

我發現php使用ascii編碼,所以爲了在sql server management studio中獲得相同的結果,例如使用varchar(8000)作爲@input。