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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? blowfish.pas

?? delphi實現(xiàn)加密算法 CRC32-Dym.................CRC32算法動態(tài)碼表實現(xiàn) CRC32-Static..............CRC32算法靜態(tài)碼表實現(xiàn) MD
?? PAS
?? 第 1 頁 / 共 2 頁
字號:

{$define UNLIMITED}          // WASSENAAR_LIMITED, UNLIMITED

unit Blowfish;

interface

uses
     Classes, SysUtils;

const
     {general constants}
     BLOCKSIZE = 8;          // Blowfish has an 8 byte block
     BUFFERSIZE = 4096;      // the buffer for file encryption

type SingleBytes = Record
     byte3: Byte; {LSB}
     byte2: BYTE;
     byte1: BYTE;
     byte0: BYTE; {MSB}
end;{SingleBytes}

type EKeyError = class(Exception);

type EFileError = class(Exception);

type EInputError = class(Exception);

type DoublWord = record
  case Integer Of
   0: (LWord: Longint);
   1: (w: singleBytes);
   2: (fByte: Array[0..3] of Byte);
 end;{DoublWord}

type PDoublWord = ^DoublWord;
type TBlock = array[0..(BLOCKSIZE - 1)] of Byte;
type PBlock  = ^TBlock;
PArray = array[0..17] of Longint;
SArray = array[0..255] of Longint;

type TCipherMode = (ECB, CBC, CFB, OFB);
type TStringMode = (smEncode, smNormal);
type Tblf_Core_ctx = record
     P :            PArray;   //P數(shù)組
     S1:            SArray;   //第1個S盒
     S2:            SArray;   //第2個S盒
     S3:            SArray;   //第3個S盒
     S4:            SArray;   //第4個S盒
     case Integer of          // Encryption/decryption block buffer
          0: (ByteBuffer: TBlock);
          1: (LongBuffer: array[0..1] of LongInt);
end; {Tblf_ctx}

type Tblf_ctx = record
     KeyInit:       Boolean;  // Shows if the password has been initialised
     IVInit:        Boolean;  // Shows if the IV has been initialised
     IV:            TBlock;   // The Initialisation Vector
     ct:            TBlock;   // temporary buffer used in CBC, CFB and OFB modes
     end; {Tblf_ctx}

type TBlowCore = class(TObject)
     ctx:          Tblf_Core_ctx;
     FPtrL:        PDoublWord;   //指向低32位數(shù)據(jù)
     FPtrR:        PDoublWord;   //指向高32位數(shù)據(jù)
public
     procedure     Blowfish_Core_Block_Encrypt;
     procedure     Blowfish_Core_Block_Decrypt;
end; {TBLowCore}

type TBlowfish = class(TObject)
  private
     FBlowCore:    TBlowCore;
     ctx:          Tblf_ctx;
     FBuffer:      array[0..BUFFERSIZE+BLOCKSIZE] of BYTE; {Local Copy of Data}
     PtrBuffer:    PBlock;
     FCipherMode:  TCipherMode;
     FStringMode:  TStringMode;
     procedure     Blowfish_Core_Key_Setup(KeyArray: array of Byte; const KeyLength: integer);
     procedure     EncryptBlockMode;
     procedure     DecryptBlockMode;
     procedure     InitArray;
     procedure     EndianEncBlock;
     procedure     EndianDecBlock;
     function      EncodeString(InputString: string): string;
     function      DecodeString(InputString: string): string;
     procedure     CheckKeys;
  public
     constructor   Create;
     destructor    Destroy; override;
     procedure     InitialiseString(const Key: string);
     procedure     LoadIVString(const IVString: string);
     procedure     EncBlock (const Input: TBlock; var Output: TBlock);
     procedure     DecBlock (const Input: TBlock; var Output: TBlock);
     procedure     EncBuffer(const Len: integer);
     procedure     DecBuffer(const Len: integer);
     procedure     EncString(const Input: string; var Output: string);
     procedure     DecString(const Input: string; var Output: string);
     procedure     Burn;
     function      GetVersion: string;
     procedure     SetCipherMode(const Value: TCipherMode);
     function      GetCipherMode: TCipherMode;
     procedure     SetStringMode(const Value: TStringMode);
     function      GetStringMode: TStringMode;
end;

implementation

uses Windows, Dialogs;

{$I BFConst.inc}

const
     MAXBYTES = 56;          // max number of bytes in the key
     N = 16;                 // Blowfish rounds (default 16)
     RELVER = '1.15';        // Version number
     LIT_COMPNAME            = 'Blowfish';
     LIT_KEY_NOT_SET         = LIT_COMPNAME + ': Key not set';
     LIT_IV_NOT_SET          = LIT_COMPNAME + ': IV not set';
     LIT_KEY_LENGTH          = LIT_COMPNAME + ': Key must be between 1 and 56 bytes';
     LIT_INFILE_NOT_FOUND    = LIT_COMPNAME + ': Input file not found';
     LIT_CBC_NOT_SET         = LIT_COMPNAME + ': Mode must be CBC for CBCMAC';
     LIT_OUTFILE_OPEN_ERROR  = LIT_COMPNAME + ': Could not open output file';
     LIT_OUTFILE_WRITE_ERROR = LIT_COMPNAME + ': Error writing output file';
     LIT_INPUT_LENGTH        = LIT_COMPNAME + ': Input not valid - too short';
     LIT_BASE64CNV           = LIT_COMPNAME + ': Error converting from Base64 - invalid character';

function TBlowfish.EncodeString(InputString: string): string;
var
  Counter:integer;
  ReturnString:string;
  b:Byte;
  i:integer;
  last:byte;
  Flush:Boolean;
  LengthInput:integer;
begin
  Counter := 0;
  ReturnString := '';
  Flush := False;
  last := 0;
  if (Length(InputString) mod 3) <> 0 then
    begin
      InputString := InputString + Chr(0);
      Flush := True;
    end;
  LengthInput := Length(InputString);
  i := 1;
  while (i <= LengthInput) do
    begin
      if i <= LengthInput then
        b := Ord(InputString[i])
      else
        b := 0;
      case Counter of
        0:
          begin
            ReturnString := ReturnString + BinToAsc[(b shr 2)];
            last := b;
          end;
        1:
          begin
            ReturnString := ReturnString + BinToAsc[((last and $3) shl 4) or ((b and $F0) shr 4) ];
            last := b;
          end;
        2:
          begin
            ReturnString := ReturnString + BinToAsc[((last and $F) shl 2) or ((b and $C0) shr 6)];
            if not (Flush and (i = LengthInput)) then
              ReturnString := ReturnString + BinToAsc[(b and $3F)];
            last := 0;
          end;
      end; {case}

      Inc(Counter);
      if Counter = 3 then
        Counter := 0;
      Inc(i);
  end; {while}
  Result := ReturnString;
end; {EncodeString}

function TBlowfish.DecodeString(InputString: string): string;
     function  DecodeBase64(b: byte): byte;
     begin
          if (b >= Ord('0')) and (b <= Ord('9')) then
          begin
               Result := b - Ord('0') + 2;
               Exit;
          end;
          if (b >= Ord('A')) and (b <= Ord('Z')) then
          begin
               Result := b - Ord('A') + 12;
               Exit;
          end;
          if (b >= Ord('a')) and (b <= Ord('z')) then
          begin
               Result := b - Ord('a') + 38;
               Exit;
          end;
          if b = Ord('+') then
          begin
               Result := 0;
               Exit;
          end;
          if b = Ord('-') then
          begin
               Result := 1;
               Exit;
          end;
          raise EConvertError.Create(LIT_BASE64CNV);
     end; {DecodeBase64}
var
     Counter:      integer;
     ReturnString: string;
     c:            Char;
     last:         byte;
     this:         byte;
     i:            integer;
begin
     Counter := 0;
     ReturnString := '';
     last := 0;

     for i := 1 to Length(InputString) do
     begin
          c := InputString[i];
          case Counter of
          0:
               begin
                    last := DecodeBase64(Ord(c)) shl 2;
               end;
          1:
               begin
                    this := DecodeBase64(Ord(c));
                    ReturnString := ReturnString + Chr((last or (this shr 4)) and $ff);
                    last := this shl 4;
               end;
          2:
               begin
                    this := DecodeBase64(Ord(c));
                    ReturnString := ReturnString + Chr((last or (this shr 2)) and $ff);
                    last := this shl 6;
               end;
          3:
               begin
                    this := DecodeBase64(Ord(c));
                    ReturnString := ReturnString + Chr((last or this) and $ff);
                    last := 0;
               end;
          end; {case}

          Inc(Counter);
          if Counter = 4 then
          begin
               Counter := 0;
          end; {if}
     end; {for}

     Result := ReturnString;
end; {DecodeString}

function TBlowfish.GetVersion;
begin
     // return the version string
     Result := LIT_COMPNAME + ' ' + RELVER;
end; {GetVersion}

procedure TBlowfish.InitialiseString(const Key: string);
var
  KeyArray: array[0..255] of Byte;
  i: integer;
begin
  if (Length(Key) < 1) or (Length(Key) > MAXBYTES) then
    begin
      raise EKeyError.Create(LIT_KEY_LENGTH);
      Exit;
    end;

  FillChar(ctx.ct, Sizeof(ctx.ct), #0);
  FillChar(FBlowCore.ctx.ByteBuffer, Sizeof(FBlowCore.ctx.ByteBuffer), #0);
  FillChar(FBlowCore.ctx.S1, Sizeof(FBlowCore.ctx.S1), #0);
  FillChar(FBlowCore.ctx.S2, Sizeof(FBlowCore.ctx.S2), #0);
  FillChar(FBlowCore.ctx.S3, Sizeof(FBlowCore.ctx.S3), #0);
  FillChar(FBlowCore.ctx.S3, Sizeof(FBlowCore.ctx.S4), #0);
  FillChar(FBlowCore.ctx.P, Sizeof(FBlowCore.ctx.P), #0);
  FillChar(KeyArray, Sizeof(KeyArray), #0);

  {$ifdef WASSENAAR_LIMITED}
  for i := 1 to Length(Key) do
    KeyArray[(i-1) mod 8] := Ord(Key[i]);
  {$else}
  for i := 1 to Length(Key) do
    KeyArray[i-1] := Ord(Key[i]);
  {$endif}
  Blowfish_Core_Key_Setup(KeyArray, Length(Key));
  ctx.KeyInit := True;
end;

procedure TBlowfish.LoadIVString(Const IVString: string);
var
  i:integer;
begin
  FillChar(ctx.IV, BLOCKSIZE, #0);
  for i := 1 to Length(IVString) do
    ctx.IV[(i-1) and (BLOCKSIZE - 1)] := ctx.IV[(i-1) and (BLOCKSIZE - 1)] xor Ord(IVString[i]);
  ctx.IVInit := True;
end;

procedure TBlowfish.EncBlock(const Input: TBlock; var Output: TBlock);
begin
  CheckKeys;
  FBlowCore.ctx.ByteBuffer := Input;
  EncryptBlockMode;
  Output := FBlowCore.ctx.ByteBuffer;
end;

procedure TBlowfish.DecBlock(const Input: TBlock; var Output: TBlock);
begin
  CheckKeys;
  FBlowCore.ctx.ByteBuffer := Input;
  DecryptBlockMode;
  Output := FBlowCore.ctx.ByteBuffer;
end;

procedure TBlowfish.EncBuffer(const Len: integer);
var
     Index: integer;
begin
     // check that we have a keys and IV
     CheckKeys;

     // index is the pointer to the current position in the buffer
     Index := 0;

     // PtrBuffer points to the address of the buffer
     PtrBuffer := @FBuffer;

     // for every block in the buffer
     repeat
          // move one block from the buffer contents into the context
          Move(FBuffer[Index], FBlowCore.ctx.ByteBuffer, BLOCKSIZE);

          // encrypt the context
          EncryptBlockMode;

          // move the block back
          Move(FBlowCore.ctx.ByteBuffer, PtrBuffer^[Index], BLOCKSIZE);

          // increment the pointer
          Inc(Index,BLOCKSIZE);
     until Index = Len;
end; {EncBuffer}

procedure TBlowfish.DecBuffer(const Len: integer);
var
     Index: integer;
begin
     CheckKeys;
     Index := 0;
     PtrBuffer := @FBuffer;
     repeat
          Move(FBuffer[Index], FBlowCore.ctx.ByteBuffer, BLOCKSIZE);
          DecryptBlockMode;
          Move(FBlowCore.ctx.ByteBuffer, PtrBuffer^[Index], BLOCKSIZE);
          Inc(Index,BLOCKSIZE);
     until Index = Len;
end;

procedure TBlowfish.EncString(const Input: string; var Output: string);
var
  i:longint;
  j:longint;
  s:string;
begin
  CheckKeys;
  Output := '';
  if Length(Input) = 0 then
    Exit;

     // load the input into the buffer
     s := Input;

     // Pad the input string to a multiple of BLOCKSIZE bytes.
     j := Length(s) + 1;
     i := BLOCKSIZE - (Length(s) mod BLOCKSIZE);
     SetLength(s, Length(s)+i);
     SetLength(Output, Length(s));

     // add the pad bytes to the end of the string
     while j <= Length(s) do
     begin
          s[j] := chr(i);
          inc(j);
     end; {while j}

     // initialise the counters
     j := 1;
     i := 1;

     // and step through the string
     while i < length(s) do
     begin
          // copy the next bytes into the context block buffer
          Move(s[i], FBlowCore.ctx.ByteBuffer, BLOCKSIZE);
          Inc(i, BLOCKSIZE);

          // perform the encryption of the context
          EncryptBlockMode;

          // copy the block into the output string
          Move(FBlowCore.ctx.ByteBuffer, Output[j], BLOCKSIZE);
          Inc(j, BLOCKSIZE);
     end; {while j}

     // encode the string if required
     if FStringMode = smEncode then
     begin
          Output := EncodeString(Output);
     end;
end; {EncString}

procedure TBlowfish.DecString(const Input: string; var Output: string);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本大道av伊人久久综合| 日韩av网站免费在线| 国产成人99久久亚洲综合精品| 337p日本欧洲亚洲大胆色噜噜| 国产一区二区三区免费看| 亚洲国产精华液网站w | 男人的j进女人的j一区| 日韩一区二区三区观看| 激情久久五月天| 欧美激情一区在线| 欧美优质美女网站| 麻豆精品一二三| 国产精品五月天| 在线观看一区二区精品视频| 另类欧美日韩国产在线| 中文字幕av资源一区| 91精品91久久久中77777| 日本成人中文字幕在线视频| 国产三级久久久| 色天天综合色天天久久| 美腿丝袜亚洲色图| 中文字幕欧美国产| 欧美日韩亚洲综合在线| 国产69精品一区二区亚洲孕妇| 一区二区三区在线看| 精品成人佐山爱一区二区| 99久久婷婷国产综合精品电影| 视频一区二区三区入口| 国产精品色一区二区三区| 欧美色网站导航| 欧美性生活久久| 经典三级在线一区| 一区二区三区在线免费观看 | 色香蕉成人二区免费| 日本不卡高清视频| 国产精品国产自产拍高清av王其| 欧美日韩高清影院| 成人性生交大片免费看中文| 午夜精品久久久久久久久久| 国产无一区二区| 欧美一区二区国产| 色av成人天堂桃色av| 精品写真视频在线观看| 亚洲福利视频一区二区| 国产清纯白嫩初高生在线观看91 | 国产日韩精品一区二区三区在线| 91成人在线免费观看| 国产成人免费9x9x人网站视频| 亚洲国产精品一区二区久久| 欧美激情一区二区三区在线| 日韩视频中午一区| 欧美日韩日日骚| 91免费观看视频| 国产精品性做久久久久久| 日韩和欧美一区二区三区| 亚洲日本护士毛茸茸| 国产欧美日韩在线看| 精品久久人人做人人爰| 3atv一区二区三区| 欧美日韩精品一区二区| 99国产精品99久久久久久| 国产激情视频一区二区三区欧美 | 久久综合国产精品| 日韩一区二区三区在线| 精品视频1区2区3区| 91免费观看在线| 99riav久久精品riav| 成人性生交大合| 国产精品系列在线播放| 韩国毛片一区二区三区| 久久99热狠狠色一区二区| 日韩av中文字幕一区二区| 日韩av午夜在线观看| 日韩精品一区第一页| 天堂va蜜桃一区二区三区漫画版 | 综合激情网...| 国产精品天天看| 国产精品欧美一区二区三区| 国产日韩欧美在线一区| 亚洲第一狼人社区| 日韩电影在线一区| 另类综合日韩欧美亚洲| 国产在线播精品第三| 久久国产精品第一页| 国产一区二区三区黄视频 | 久久久高清一区二区三区| 久久久精品影视| 国产精品国产三级国产aⅴ原创 | 日韩一本二本av| 精品国产一区二区三区四区四| 精品人伦一区二区色婷婷| 欧美精品一区二区三区蜜臀| 久久精品亚洲精品国产欧美| 中文字幕+乱码+中文字幕一区| 国产精品国产三级国产| 一区二区三区日韩在线观看| 亚洲国产人成综合网站| 免费视频最近日韩| 国产一区二区三区在线看麻豆| 国产成人日日夜夜| 成人h精品动漫一区二区三区| 99精品国产热久久91蜜凸| 欧美日韩在线免费视频| 欧美一级电影网站| 中文在线一区二区| 午夜免费久久看| 国产精品亚洲第一| 色婷婷久久99综合精品jk白丝| 欧美三级电影在线看| 26uuu国产一区二区三区| 国产精品国产自产拍高清av | 色吧成人激情小说| 日韩欧美在线1卡| 国产精品不卡一区| 理论电影国产精品| av电影天堂一区二区在线| 欧美一区二区视频免费观看| 国产色产综合色产在线视频| 亚洲电影欧美电影有声小说| 国产精品一色哟哟哟| 欧美亚洲综合网| 久久精品夜夜夜夜久久| 午夜欧美大尺度福利影院在线看| 国产电影一区在线| 欧美日韩夫妻久久| 日韩伦理av电影| 国产一区二区导航在线播放| 欧美丝袜自拍制服另类| 国产精品久久免费看| 蜜臀va亚洲va欧美va天堂| 91美女视频网站| 久久久噜噜噜久久人人看| 亚洲18色成人| 日本精品一区二区三区高清| 久久先锋影音av鲁色资源网| 婷婷国产在线综合| 色综合天天综合| 欧美激情一区在线| 韩国中文字幕2020精品| 欧美美女bb生活片| 亚洲理论在线观看| 丰满少妇在线播放bd日韩电影| 777奇米四色成人影色区| 亚洲免费大片在线观看| 高清不卡一区二区在线| 精品奇米国产一区二区三区| 日韩高清不卡一区二区| 欧美性受极品xxxx喷水| 亚洲视频一区在线| 从欧美一区二区三区| 精品91自产拍在线观看一区| 日韩和欧美的一区| 欧美精品第1页| 亚洲第一av色| 欧美日韩激情一区二区| 一区二区三区四区国产精品| 91婷婷韩国欧美一区二区| 久久精品亚洲国产奇米99| 国产在线播放一区| 精品国产91久久久久久久妲己 | 亚洲国产成人porn| 色综合天天视频在线观看| 国产精品热久久久久夜色精品三区| 精品一区二区三区视频在线观看| 日韩一本二本av| 麻豆成人av在线| 精品捆绑美女sm三区| 久草精品在线观看| 精品少妇一区二区三区视频免付费| 日本欧美肥老太交大片| 欧美一级xxx| 国产一区二区免费视频| 久久久久久久av麻豆果冻| 国产精品1区2区| 综合久久久久久| 欧美影院一区二区| 日产精品久久久久久久性色 | 2020国产精品自拍| 国产毛片精品一区| 国产精品不卡视频| 在线视频一区二区三| 视频一区欧美日韩| 欧美tickle裸体挠脚心vk| 国产成人精品一区二区三区四区 | 国产精品久久久久久久久久久免费看 | 国产成人精品免费看| 国产精品免费视频一区| 91亚洲国产成人精品一区二区三| 亚洲精品乱码久久久久久| 欧美日本一区二区在线观看| 蜜桃久久久久久| 国产精品免费av| 欧美在线视频不卡| 精品一区二区三区在线观看国产 | 久久国产免费看| 国产欧美一区二区精品性色| 91丨九色丨蝌蚪富婆spa| 亚州成人在线电影| 久久久亚洲午夜电影| 色呦呦网站一区|