pwdencrypt:pwdencrypt实现对输入数据进行加密后返回二进制形式的加密内容
pwdcompare:pwdcompare用于检查明文是否与加密的二进制数据内容相等,没有解密函数。
这是二个SQLServer未公开的函数,主要是用于SQLServer内部自己调用。优点是调用方便,缺点是这二个函数没有公开,就意味着可能改变,并且不兼容原来的,在使用上存在风险。(只在sqlserver验证了一下)
1 create table #temptable(iorder int, pswd varbinary(1024) )
2
3 go
4
5 insert into #temptable values(1, pwdencrypt('lai'))
6
7 insert into #temptable values(2, pwdencrypt('512343975'))
8
9 insert into #temptable values(3, pwdencrypt('lai512343975'))
10
11 go
12
13 select * from #temptable
14
15 go
16
17 -- 比较数据是否相等
18
19 select * from #temptable
20
21 where pwdcompare('512343975', pswd)=1
22
23 go
24
25 drop table #temptable
26
27 go
28
2
3 go
4
5 insert into #temptable values(1, pwdencrypt('lai'))
6
7 insert into #temptable values(2, pwdencrypt('512343975'))
8
9 insert into #temptable values(3, pwdencrypt('lai512343975'))
10
11 go
12
13 select * from #temptable
14
15 go
16
17 -- 比较数据是否相等
18
19 select * from #temptable
20
21 where pwdcompare('512343975', pswd)=1
22
23 go
24
25 drop table #temptable
26
27 go
28