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

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

?? blowfish.~pas

?? delphi實現加密算法 CRC32-Dym.................CRC32算法動態碼表實現 CRC32-Static..............CRC32算法靜態碼表實現 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數組
     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位數據
     FPtrR:        PDoublWord;   //指向高32位數據
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; {InitialiseString}

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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产激情av| 国产福利不卡视频| 粉嫩aⅴ一区二区三区四区五区| eeuss鲁片一区二区三区在线看| 91精品国产综合久久福利| ...av二区三区久久精品| 麻豆国产一区二区| 欧亚洲嫩模精品一区三区| 国产色综合久久| 韩国女主播一区| 欧美电影影音先锋| 亚洲美女在线国产| www.成人网.com| 国产亚洲欧美一级| 精品一区二区三区av| 制服丝袜日韩国产| 亚洲成人av一区二区三区| 日本韩国视频一区二区| 亚洲丝袜另类动漫二区| 成人性生交大片免费看在线播放 | 亚洲不卡av一区二区三区| www.欧美.com| 国产精品精品国产色婷婷| 国产精品一区二区黑丝| 精品国产乱码久久久久久久| 另类专区欧美蜜桃臀第一页| 欧美一区二区三区思思人| 亚洲成人在线观看视频| 欧美视频自拍偷拍| 亚洲成人av中文| 欧美日韩精品一区二区| 日日摸夜夜添夜夜添国产精品| 在线观看av不卡| 首页国产欧美久久| 欧美日韩1234| 久久91精品国产91久久小草| 久久丝袜美腿综合| 成人一区二区三区视频在线观看| 日本一区二区三级电影在线观看| 国产成人免费av在线| 中文字幕成人网| 91尤物视频在线观看| 一区二区三区日韩精品| 欧美日韩亚洲综合一区| 日本欧美一区二区| 久久久五月婷婷| 91免费看视频| 亚洲3atv精品一区二区三区| 日韩一区二区三区在线视频| 久久99久久99小草精品免视看| 精品美女在线播放| 成人爱爱电影网址| 亚洲福利电影网| 久久综合中文字幕| 色94色欧美sute亚洲线路一ni| 亚洲国产一二三| 精品国产网站在线观看| 99国产精品久久久| 青青草原综合久久大伊人精品优势| 26uuu色噜噜精品一区| 94-欧美-setu| 久久机这里只有精品| 中文字幕av一区二区三区免费看| 欧美综合在线视频| 国产精品夜夜嗨| 亚洲成人av一区| 中文字幕欧美区| 日韩视频免费观看高清完整版| 国产成人精品亚洲午夜麻豆| 亚洲国产精品欧美一二99| 久久综合丝袜日本网| 欧美三级视频在线播放| 国产馆精品极品| 日本不卡的三区四区五区| 国产精品免费av| 精品国产乱码久久久久久蜜臀| 9色porny自拍视频一区二区| 久久精品久久99精品久久| 一区二区三区在线免费视频| 久久这里都是精品| 欧美日本一区二区三区| av成人动漫在线观看| 极品美女销魂一区二区三区| 亚洲成人www| 亚洲另类在线视频| 中文字幕精品在线不卡| 亚洲精品一区二区三区福利| 欧美日韩国产另类不卡| 成人午夜在线播放| 韩国av一区二区三区在线观看| 亚洲综合成人网| 中文字幕中文字幕在线一区| 国产性做久久久久久| 欧美不卡激情三级在线观看| 在线观看国产91| 91美女在线观看| 99久久国产综合精品麻豆| 国产成人一区在线| 国产原创一区二区三区| 蜜桃精品视频在线观看| 日韩不卡一区二区| 日韩国产精品91| 日韩在线播放一区二区| 亚洲成在人线在线播放| 亚洲亚洲人成综合网络| 亚洲一区二区精品久久av| 亚洲精品国产第一综合99久久| 综合欧美亚洲日本| 中文字幕亚洲在| 中文字幕在线免费不卡| 久久一留热品黄| 国产视频一区在线播放| 久久久久久久电影| 欧美国产在线观看| 中文字幕中文字幕在线一区 | 亚洲成av人影院在线观看网| 一区二区欧美视频| 一区二区三国产精华液| 亚洲第一搞黄网站| 免费欧美在线视频| 国产在线看一区| 国产成人精品免费看| 国产成人a级片| 国产成人av在线影院| 99精品视频一区二区三区| 色av一区二区| 3atv在线一区二区三区| 欧美一区二区成人| 国产亚洲综合色| 一区二区视频在线看| 性感美女极品91精品| 麻豆国产欧美一区二区三区| 国产精品综合在线视频| jvid福利写真一区二区三区| 欧美伊人久久大香线蕉综合69| 欧美日韩午夜在线视频| 91精品国产综合久久精品app| 日韩三级视频在线看| 国产午夜久久久久| 亚洲综合成人在线视频| 麻豆精品新av中文字幕| 成人av电影在线播放| 欧美日韩国产bt| 久久久久久免费| 亚洲在线观看免费视频| 麻豆高清免费国产一区| 成人亚洲精品久久久久软件| 欧美日韩国产三级| 国产农村妇女毛片精品久久麻豆| 亚洲精品久久嫩草网站秘色| 免费观看成人鲁鲁鲁鲁鲁视频| 成人综合在线观看| 制服丝袜亚洲色图| 成人欧美一区二区三区白人| 日本亚洲免费观看| 99久久亚洲一区二区三区青草| 欧美一区二区免费| 亚洲女人的天堂| 国产精品一线二线三线| 欧美日韩亚洲综合一区二区三区| 国产视频视频一区| 麻豆一区二区在线| 欧美三区在线观看| 国产精品久久久久久久久久久免费看 | 午夜日韩在线电影| 成人黄色网址在线观看| 欧美酷刑日本凌虐凌虐| 国产精品第四页| 国产成人av一区二区三区在线观看| 欧美日韩一区二区在线观看视频| 欧美激情中文字幕一区二区| 麻豆久久久久久| 欧美午夜精品久久久| 亚洲婷婷综合久久一本伊一区 | 91在线视频免费观看| 精品国产一区a| 日本欧美在线看| 欧美日韩精品是欧美日韩精品| 中文字幕亚洲欧美在线不卡| 国产精品综合一区二区| 精品国产在天天线2019| 日韩高清欧美激情| 欧美久久久久久久久中文字幕| 亚洲女人小视频在线观看| 成人综合在线网站| 中文字幕乱码一区二区免费| 国产麻豆精品在线| 日韩精品一区二区三区中文精品| 五月天久久比比资源色| 欧美日韩在线三级| 夜夜爽夜夜爽精品视频| 日本久久一区二区三区| 亚洲免费看黄网站| 色偷偷一区二区三区| 亚洲黄色免费网站| 在线视频观看一区| 性做久久久久久免费观看欧美| 欧美偷拍一区二区| 午夜日韩在线观看| 6080国产精品一区二区|