- 相關(guān)推薦
三級(jí)數(shù)據(jù)庫:在SQLSERVER中實(shí)現(xiàn)RSA加密算法
為了使廣大考生在備戰(zhàn)計(jì)算機(jī)等級(jí)考試時(shí),更快的掌握相應(yīng)知識(shí)點(diǎn),下面是小編搜索整理的三級(jí)數(shù)據(jù)庫:在SQLSERVER中實(shí)現(xiàn)RSA加密算法,供參考練習(xí),預(yù)?忌鷤兛汲鲎约豪硐氲某煽!
三級(jí)數(shù)據(jù)庫:在SQLSERVER中實(shí)現(xiàn)RSA加密算法
/*本次修改增加了unicode的支持,但是加密后依然顯示為16進(jìn)制數(shù)據(jù),因?yàn)檫M(jìn)行RSA加密后所得到的unicode編碼是無法顯示的,所以密文依然采用16進(jìn)制數(shù)據(jù)顯示。
需要特別注意:如果要對(duì)中文進(jìn)行加密,那么所選取的兩個(gè)素?cái)?shù)要比較大,兩個(gè)素?cái)?shù)的成績最好要大于65536,即大于unicode的最大編碼值
在SQL SERVER中實(shí)現(xiàn)RSA加密算法(第二版)
--判斷是否為素?cái)?shù)
if object_id(’f_primeNumTest’) is not null
drop function f_primeNumTest
go
create function [dbo].[f_primeNumTest]
(@p int)
returns bit
begin
declare @flg bit,@i int
select @flg=1, @i=2
while @i<sqrt(@p)
begin
if(@p%@i=0 )
beginwww.Examw.CoM
set @flg=0
break
end
set @i=@i+1
end
return @flg
end
go
--判斷兩個(gè)數(shù)是否互素
if object_id(’f_isNumsPrime’) is not null
drop function f_isNumsPrime
go
create function f_isNumsPrime
(@num1 int,@num2 int)
returns bit
begin考試通
declare @tmp int,@flg bit
set @flg=1
while (@num2%@num1<>0)
begin
select @tmp=@num1,@num1=@num2%@num1,@num2=@tmp
end
if @num1=1
set @flg=0
return @flg
end
go
--產(chǎn)生密鑰對(duì)
if object_id(’p_createKey’) is not null
drop proc p_createKey
go
create proc p_createKey
@p int,@q int
as
【三級(jí)數(shù)據(jù)庫:在SQLSERVER中實(shí)現(xiàn)RSA加密算法】相關(guān)文章:
PHP實(shí)現(xiàn)RSA加密類的實(shí)例解析05-20
PHP 中 MySQL 數(shù)據(jù)庫異步查詢實(shí)現(xiàn)03-03
Java中4大基本加密算法07-29
phpYii2框架實(shí)現(xiàn)數(shù)據(jù)庫的方法07-11
三級(jí)數(shù)據(jù)庫備考經(jīng)驗(yàn)07-26
PHP中多態(tài)如何實(shí)現(xiàn)05-06
PHP中實(shí)現(xiàn)頁面跳轉(zhuǎn)07-06