亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fgintrsa.pas

?? RSA動態(tài)庫文件
?? PAS
字號:
{License, info, etc
 ------------------

This implementation is made by Walied Othman, to contact me
mail to Walied.Othman@Student.KULeuven.ac.be or
Triade@ace.Ulyssis.Student.KULeuven.ac.be,
always mention wether it 's about the FGInt for Delphi or for
FreePascal, or wether it 's about the 6xs, preferably in the subject line.
If you 're going to use these implementations, at least mention my
name or something and notify me so I may even put a link on my page.
This implementation is freeware and according to the coderpunks'
manifesto it should remain so, so don 't use these implementations
in commercial software.  Encryption, as a tool to ensure privacy
should be free and accessible for anyone.  If you plan to use these
implementations in a commercial application, contact me before
doing so, that way you can license the software to use it in commercial
Software.  If any algorithm is patented in your country, you should
acquire a license before using this software.  Modified versions of this
software must contain an acknowledgement of the original author (=me).
This implementaion is available at
http://ace.ulyssis.student.kuleuven.ac.be/~triade/

copyright 2000, Walied Othman
This header may not be removed.
}

unit FGIntRSA;

interface

uses Windows, SysUtils, Controls, FGInt;

procedure RSAEncrypt(p: string; var exp, Modb: TFGInt; var e: string);
procedure RSADecrypt(e: string; var exp, Modb, d_p, d_q, p, q: TFGInt; var d: string);
procedure RSASign(m: string; var d, n, dp, dq, p, q: TFGInt; var s: string);
procedure RSAVerify(m, s: string; var e, n: TFGInt; var valid: boolean);


implementation


{$H+}




// Encrypt a string with the RSA algorithm, P^exp mod modb = E

procedure RSAEncrypt(p: string; var exp, Modb: TFGInt; var e: string);
var
  i, j, modbits: longint;
  PGInt, temp, zero: TFGInt;
  tempstr1, tempstr2, tempstr3: string;
begin
  Base2StringToFGInt('0', zero);
  FGIntToBase2String(Modb, tempstr1);
  modbits := Length(tempstr1);
  ConvertBase256to2(p, tempstr1);
  tempstr1 := '111' + tempstr1;
  j := modbits - 1;
  while (Length(tempstr1) mod j) <> 0 do
    tempstr1 := '0' + tempstr1;

  j := Length(tempstr1) div (modbits - 1);
  tempstr2 := '';
  for i := 1 to j do
  begin
    tempstr3 := copy(tempstr1, 1, modbits - 1);
    while (copy(tempstr3, 1, 1) = '0') and (Length(tempstr3) > 1) do
      delete(tempstr3, 1, 1);
    Base2StringToFGInt(tempstr3, PGInt);
    delete(tempstr1, 1, modbits - 1);
    if tempstr3 = '0' then
      FGIntCopy(zero, temp)
    else
      FGIntMontgomeryModExp(PGInt, exp, Modb, temp);
    FGIntDestroy(PGInt);
    tempstr3 := '';
    FGIntToBase2String(temp, tempstr3);
    while (Length(tempstr3) mod modbits) <> 0 do
      tempstr3 := '0' + tempstr3;
    tempstr2 := tempstr2 + tempstr3;
    FGIntDestroy(temp);
  end;

  while (tempstr2[1] = '0') and (Length(tempstr2) > 1) do
    delete(tempstr2, 1, 1);
  ConvertBase2to256(tempstr2, e);
  FGIntDestroy(zero);
end;


// Decrypt a string with the RSA algorithm, E^exp mod modb = D
// provide nil for exp.Number if you want a speedup by using the chinese
// remainder theorem, modb = p*q, d_p*e mod (p-1) = 1 and
// d_q*e mod (q-1) where e is the encryption exponent used

procedure RSADecrypt(e: string; var exp, Modb, d_p, d_q, p, q: TFGInt; var d: string);
var
  i, j, modbits: longint;
  EGInt, temp, temp1, temp2, temp3, ppinvq, qqinvp, zero: TFGInt;
  tempstr1, tempstr2, tempstr3: string;
begin
  Base2StringToFGInt('0', zero);
  FGIntToBase2String(Modb, tempstr1);
  modbits := Length(tempstr1);
  ConvertBase256to2(e, tempstr1);
  while copy(tempstr1, 1, 1) = '0' do
    delete(tempstr1, 1, 1);
  while (Length(tempstr1) mod modbits) <> 0 do
    tempstr1 := '0' + tempstr1;
  if exp.Number = nil then
  begin
    FGIntModInv(q, p, temp1);
    FGIntMul(q, temp1, qqinvp);
    FGIntDestroy(temp1);
    FGIntModInv(p, q, temp1);
    FGIntMul(p, temp1, ppinvq);
    FGIntDestroy(temp1);
  end;

  j := Length(tempstr1) div modbits;
  tempstr2 := '';
  for i := 1 to j do
  begin
    tempstr3 := copy(tempstr1, 1, modbits);
    while (copy(tempstr3, 1, 1) = '0') and (Length(tempstr3) > 1) do
      delete(tempstr3, 1, 1);
    Base2StringToFGInt(tempstr3, EGInt);
    delete(tempstr1, 1, modbits);
    if tempstr3 = '0' then
      FGIntCopy(zero, temp)
    else
    begin
      if exp.Number <> nil then
        FGIntMontgomeryModExp(EGInt, exp, Modb, temp)
      else
      begin
        FGIntMontgomeryModExp(EGInt, d_p, p, temp1);
        FGIntMul(temp1, qqinvp, temp3);
        FGIntCopy(temp3, temp1);
        FGIntMontgomeryModExp(EGInt, d_q, q, temp2);
        FGIntMul(temp2, ppinvq, temp3);
        FGIntCopy(temp3, temp2);
        FGIntAddMod(temp1, temp2, Modb, temp);
        FGIntDestroy(temp1);
        FGIntDestroy(temp2);
      end;
    end;
    FGIntDestroy(EGInt);
    tempstr3 := '';
    FGIntToBase2String(temp, tempstr3);
    while (Length(tempstr3) mod (modbits - 1)) <> 0 do
      tempstr3 := '0' + tempstr3;
    tempstr2 := tempstr2 + tempstr3;
    FGIntDestroy(temp);
  end;

  if exp.Number = nil then
  begin
    FGIntDestroy(ppinvq);
    FGIntDestroy(qqinvp);
  end;
  while (not (copy(tempstr2, 1, 3) = '111')) and (Length(tempstr2) > 3) do
    delete(tempstr2, 1, 1);
  delete(tempstr2, 1, 3);
  ConvertBase2to256(tempstr2, d);
  FGIntDestroy(zero);
end;


// Sign strings with the RSA algorithm, M^d mod n = S
// provide nil for exp.Number if you want a speedup by using the chinese
// remainder theorem, n = p*q, dp*e mod (p-1) = 1 and
// dq*e mod (q-1) where e is the encryption exponent used


procedure RSASign(m: string; var d, n, dp, dq, p, q: TFGInt; var s: string);
var
  MGInt, SGInt, temp, temp1, temp2, temp3, ppinvq, qqinvp: TFGInt;
begin
  Base256StringToFGInt(m, MGInt);
  if d.Number <> nil then
    FGIntMontgomeryModExp(MGInt, d, n, SGInt)
  else
  begin
    FGIntModInv(p, q, temp);
    FGIntMul(p, temp, ppinvq);
    FGIntDestroy(temp);
    FGIntModInv(q, p, temp);
    FGIntMul(q, temp, qqinvp);
    FGIntDestroy(temp);
    FGIntMontgomeryModExp(MGInt, dp, p, temp1);
    FGIntMul(temp1, qqinvp, temp2);
    FGIntCopy(temp2, temp1);
    FGIntMontgomeryModExp(MGInt, dq, q, temp2);
    FGIntMul(temp2, ppinvq, temp3);
    FGIntCopy(temp3, temp2);
    FGIntAddMod(temp1, temp2, n, SGInt);
    FGIntDestroy(temp1);
    FGIntDestroy(temp2);
    FGIntDestroy(ppinvq);
    FGIntDestroy(qqinvp);
  end;
  FGIntToBase256String(SGInt, s);
  FGIntDestroy(MGInt);
  FGIntDestroy(SGInt);
end;


// Verify digitally signed strings with the RSA algorihthm,
// If M = S^e mod n then ok:=true else ok:=false

procedure RSAVerify(m, s: string; var e, n: TFGInt; var valid: boolean);
var
  MGInt, SGInt, temp: TFGInt;
begin
  Base256StringToFGInt(s, SGInt);
  Base256StringToFGInt(m, MGInt);
  FGIntMod(MGInt, n, temp);
  FGIntCopy(temp, MGInt);
  FGIntMontgomeryModExp(SGInt, e, n, temp);
  FGIntCopy(temp, SGInt);
  valid := (FGIntCompareAbs(SGInt, MGInt) = Eq);
  FGIntDestroy(SGInt);
  FGIntDestroy(MGInt);
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜一区二区三区免费大片| 欧美一级一区二区| 日韩一区二区电影网| 亚洲国产精品99久久久久久久久| 一区二区理论电影在线观看| 国产毛片精品一区| 欧美日韩亚洲国产综合| 中文字幕免费不卡| 国产乱人伦偷精品视频不卡| 欧美日韩一级二级三级| 亚洲日本免费电影| 国产成人av电影在线播放| 欧美日韩国产免费一区二区| 亚洲三级小视频| 国产成人在线免费| 久久综合色8888| 青青草原综合久久大伊人精品优势| 99国产精品久久| 中文字幕不卡的av| 丁香一区二区三区| 欧美国产精品中文字幕| 国产美女精品在线| 国产三级三级三级精品8ⅰ区| 久久激情五月激情| 欧美日韩高清在线| 亚洲国产裸拍裸体视频在线观看乱了| 不卡视频一二三四| 国产精品久久久久久久久动漫 | 国产日产欧产精品推荐色| 日韩精彩视频在线观看| 欧美日韩精品免费| 亚洲bdsm女犯bdsm网站| 欧美亚洲图片小说| 亚洲成人一区在线| 欧美精品久久一区二区三区| 亚洲成av人片一区二区| 欧美乱妇15p| 日本特黄久久久高潮| 欧美一卡二卡三卡四卡| 久久国产精品无码网站| 亚洲欧洲性图库| 欧美综合一区二区三区| 亚洲图片欧美色图| 欧美人xxxx| 狠狠色综合色综合网络| 久久精品欧美日韩精品| www.亚洲精品| 一区二区高清在线| 欧美人妇做爰xxxⅹ性高电影| 青青青伊人色综合久久| 久久久精品中文字幕麻豆发布| 国产精品一区二区免费不卡 | 日韩高清一区在线| 欧美电影免费观看高清完整版| 黑人精品欧美一区二区蜜桃| 久久精品网站免费观看| 91首页免费视频| 婷婷久久综合九色综合伊人色| 制服丝袜中文字幕亚洲| 久久精品国产99| 国产精品私房写真福利视频| 欧美影院一区二区三区| 久草精品在线观看| 日韩一区在线看| 日韩一区二区在线观看视频播放| 国产精品一区二区在线看| 一区二区三区四区不卡在线| 欧美成人福利视频| 91视频一区二区| 日韩高清在线不卡| 欧美韩日一区二区三区| 在线视频中文字幕一区二区| 免费久久99精品国产| 国产精品久久夜| 欧美电视剧免费全集观看| 成年人国产精品| 久久成人综合网| 亚洲午夜精品在线| 国产精品午夜免费| 日韩欧美aaaaaa| 在线视频一区二区三| 久久99精品久久只有精品| 亚洲日本va午夜在线电影| 欧美第一区第二区| 在线观看日韩国产| 成人免费精品视频| 日本中文字幕一区二区视频 | 久久免费看少妇高潮| 欧美专区亚洲专区| 粉嫩一区二区三区性色av| 日日夜夜精品免费视频| 亚洲欧美日韩国产成人精品影院| 久久久夜色精品亚洲| 在线观看91av| 欧美性大战xxxxx久久久| 成人精品国产免费网站| 国内精品久久久久影院一蜜桃| 亚洲国产综合色| 亚洲欧美一区二区久久| 国产精品国产三级国产专播品爱网 | 日本不卡在线视频| 一区二区三区电影在线播| 国产精品女同互慰在线看| 精品区一区二区| 欧美一级精品在线| 欧美色综合天天久久综合精品| 不卡的av电影在线观看| 成人免费高清在线| 国产乱码精品一区二区三区av| 另类小说欧美激情| 麻豆国产一区二区| 日韩电影免费在线观看网站| 亚洲一区欧美一区| 亚洲尤物视频在线| 午夜影院在线观看欧美| 亚洲午夜久久久久久久久电影网| 亚洲在线观看免费视频| 亚洲国产综合色| 日韩av一区二区在线影视| 天天影视色香欲综合网老头| 亚洲成人精品一区| 午夜精品久久久久久久| 日韩国产欧美一区二区三区| 玖玖九九国产精品| 激情综合色播激情啊| 国产主播一区二区| 波多野洁衣一区| 91一区二区三区在线观看| 在线视频一区二区三区| 91.com视频| 久久免费视频色| 亚洲精品老司机| 亚洲成人精品影院| 久久99精品久久久久婷婷| 成人中文字幕合集| 一本色道久久综合亚洲aⅴ蜜桃 | 久久久综合激的五月天| 国产精品午夜久久| 亚洲国产中文字幕在线视频综合| 视频在线观看91| 国产一区二区三区电影在线观看| 大胆欧美人体老妇| 欧美午夜一区二区三区免费大片| 日韩欧美在线观看一区二区三区| 欧美tk—视频vk| 亚洲女同ⅹxx女同tv| 人人精品人人爱| 成人手机电影网| 欧美日韩精品一区二区三区四区 | 亚洲精品久久久久久国产精华液| 午夜国产精品一区| 国产麻豆精品theporn| 99久久er热在这里只有精品15| 欧美日韩在线播| 久久精品夜色噜噜亚洲aⅴ| 亚洲三级免费观看| 麻豆国产精品官网| 色狠狠色狠狠综合| 久久久久97国产精华液好用吗| 亚洲综合成人在线视频| 国产麻豆成人传媒免费观看| 一本一道久久a久久精品综合蜜臀| 欧美一区二区美女| 亚洲精品视频一区二区| 韩日精品视频一区| 欧美日韩国产精品成人| 中文字幕精品一区二区精品绿巨人| 亚洲成人综合网站| 91视频国产观看| 国产亚洲欧美日韩日本| 午夜精品福利一区二区三区av| 成人av在线影院| 久久精品日韩一区二区三区| 午夜a成v人精品| 色综合欧美在线视频区| 久久九九久久九九| 精品亚洲porn| 欧美麻豆精品久久久久久| 日韩毛片一二三区| 国产成人综合网| 欧美v日韩v国产v| 同产精品九九九| 91福利国产精品| 亚洲素人一区二区| 成人综合在线观看| 国产日产亚洲精品系列| 国内精品久久久久影院薰衣草| 欧美一区二区三区啪啪| 亚洲一区二区精品视频| 91麻豆精品视频| 自拍偷拍国产精品| www.一区二区| 中文字幕中文字幕在线一区 | 精品无人码麻豆乱码1区2区 | 国产精品一线二线三线| 精品欧美一区二区在线观看| 美国精品在线观看| 欧美一区二区三区免费视频| 免费成人小视频| 久久人人97超碰com|