MySQL中的SQL Server 2005 hashbytes('sha1','code')替代 [英] SQL Server 2005 hashbytes(‘sha1’,'code') alternative in MySQL
本文介绍了MySQL中的SQL Server 2005 hashbytes('sha1','code')替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几种以此方式加密的密码:
Hi i have several passwords encrypted in this way:
hashbytes(‘sha1’,'password')
我们计划使用SQL Server 2005迁移到MySQL.
Using SQL Server 2005, we are planing a migration to MySQL.
在MySQL或PHP中有等效的哈希函数.
There is a hash function equivalent in MySQL or PHP.
因为我使用标准的SHA1算法,结果却与使用SQL Server算法的结果不同.
Because i use a standard SHA1 algorithm and results are different that the ones i have using SQL Server algorithm.
推荐答案
我发现php使用ascii编码,因此,例如,为了在sql server management studio中获得相同的结果,请使用varchar(8000)作为@输入.
I found out that php uses ascii encoding, so in order to get the same results in sql server management studio for example, use a varchar(8000) as @input.
这篇关于MySQL中的SQL Server 2005 hashbytes('sha1','code')替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文