Equivalent of sha1 in db2
I've stored password in mysql using SHA1 encryption And I have migrated my DB from mysql to DB2.
From Db2, how can I fetch record from Db2?
Select * from table where name = 'user' and password = sha1('123456')
But it generates error开发者_如何学Python in db2. How can I check the login for the existing details?
If the original app contains only a few references to sha1() in the SQL statements, you could switch them a similar function in DB2, such as ENCRYPT() http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0004211.html.
Now you have a HASH function
SELECT HEX(HASH('Charlie at IBM',1)) FROM SYSIBM.SYSDUMMY1;
D6E42303462491FC696EAC53C1B086A5034735A7
精彩评论