<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog01.html" frameborder="0" width="728" scrolling="no" height="90"></iframe> 
  
    
      
         //
        
        
          *******************************************************************************
        
          //
        
        
          *******************************************************************************
        
        
          
           *
        
        
          IDEA数据加密算法1.0版本
        
        
        
        
          *
        
        
          IDEA数据加密算法1.0版本
          
           *
        
        
          开发作者:成晓旭
        
        
          *
        
        
          开发作者:成晓旭
          
           *
        
        
          项目简述:IDEA数据加密算法1.0版本
        
        
          *
        
        
          项目简述:IDEA数据加密算法1.0版本
          
           *
        
        
          启动时间:2000年05月08日
        
        
          *
        
        
          启动时间:2000年05月08日
          
           *
        
        
          完成时间:2000年01月14日
        
        
          20
        
        
          :
        
        
          09
        
        
          :
        
        
          00
        
        
        
        
          
            1个晚上
          
          
            >
        
        
          *
        
        
          完成时间:2000年01月14日
        
        
          20
        
        
          :
        
        
          09
        
        
          :
        
        
          00
        
        
        
        
          
            1个晚上
          
          
            >
          
          
            
             *
          
          
            *
          
          
            
             *
          
          
            开发环境:Windows98
          
          
            *
          
          
            开发环境:Windows98
            
             *
          
          
            开发工具:BorlandDelphi5
          
          
            *
          
          
            开发工具:BorlandDelphi5
            
             *
          
          
            *
          
          
            
             *
          
          
            文件名称:IDEA.pas
          
          
            *
          
          
            文件名称:IDEA.pas
            
             *
          
          
            简介:IDEA数据加密算法1.0版本
          
          
            *
          
          
            简介:IDEA数据加密算法1.0版本
            
             *
          
          
            *
          
          
            
             *
          
          
            备注:任何人使用此文件时,请保留此段自述文件,谢谢
          
          
            !
          
          
            *
          
          
            备注:任何人使用此文件时,请保留此段自述文件,谢谢
          
          
            !
          
          
            
             *
          
          
            *
          
          
            
             ******************************************************************************/
          
          
            ******************************************************************************/
          
          
            
             unitIDEA;
            unitIDEA;
            
             
            
             interface
          
          
            interface
          
          
            
             
            
             uses
            uses
            
             Windows,Messages,SysUtils,Classes,Dialogs;
            Windows,Messages,SysUtils,Classes,Dialogs;
            
             functionBinToHex(strBin:string):string;
            functionBinToHex(strBin:string):string;
            
             functionHexToTen(strHex:string):int64;
            functionHexToTen(strHex:string):int64;
            
             functionLeftMove(S:string;P:integer):String;
            functionLeftMove(S:string;P:integer):String;
            
             functionModAdd(intAdd1,intAdd2:int64):int64;
            functionModAdd(intAdd1,intAdd2:int64):int64;
            
             functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
            functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
            
             functionModXor(intXor1,intXor2:int64):int64;
            functionModXor(intXor1,intXor2:int64):int64;
            
             procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
          
          
            //
          
          
            产生加密子密钥函数
            procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
          
          
            //
          
          
            产生加密子密钥函数
          
          
            
             procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
          
          
            //
          
          
            求取解密子密钥函数
          
          
            procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
          
          
            //
          
          
            求取解密子密钥函数
          
          
            
             procedureCreateKeyTable();
          
          
            //
          
          
            产生加、解密子密钥之间的对应关系表
          
          
            procedureCreateKeyTable();
          
          
            //
          
          
            产生加、解密子密钥之间的对应关系表
          
          
            
             procedureRiddle(arrPassword:arrayofint64;arrRiddleKey:arrayofint64;VARarrOpenPassword:arrayofint64);StdCall;export;
          
          
            //
          
          
            IDEA数据解密函数
          
          
            procedureRiddle(arrPassword:arrayofint64;arrRiddleKey:arrayofint64;VARarrOpenPassword:arrayofint64);StdCall;export;
          
          
            //
          
          
            IDEA数据解密函数
          
          
            
             procedureCreateOpenPassword(VARarrOpenPassKey:arrayofint64);
          
          
            //
          
          
            产生解密子密钥函数
          
          
            procedureCreateOpenPassword(VARarrOpenPassKey:arrayofint64);
          
          
            //
          
          
            产生解密子密钥函数
          
          
            
             procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
          
          
            //
          
          
            产生加密密钥函数
          
          
            procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
          
          
            //
          
          
            产生加密密钥函数
          
          
            
             
          
          
            
             
            
             implementation
            implementation
            
             
            
             ConststrNum:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]ofstring[
          
          
            4
          
          
            ]
          
          
            =
          
          
            (
          
          
            '
          
          
            0000
          
          
            '
          
          
            ,
          
          
            '
          
          
            0001
          
          
            '
          
          
            ,
          
          
            '
          
          
            0010
          
          
            '
          
          
            ,
          
          
            '
          
          
            0011
          
          
            '
          
          
            ,
          
          
            '
          
          
            0100
          
          
            '
          
          
            ,
          
          
            '
          
          
            0101
          
          
            '
          
          
            ,
          
          
            '
          
          
            0110
          
          
            '
          
          
            ,
          
          
            '
          
          
            0111
          
          
            '
          
          
            ,
          
          
            '
          
          
            1000
          
          
            '
          
          
            ,
          
          
            '
          
          
            1001
          
          
            '
          
          
            ,
          
          
            '
          
          
            1010
          
          
            '
          
          
            ,
          
          
            '
          
          
            1011
          
          
            '
          
          
            ,
          
          
            '
          
          
            1100
          
          
            '
          
          
            ,
          
          
            '
          
          
            1101
          
          
            '
          
          
            ,
          
          
            '
          
          
            1110
          
          
            '
          
          
            ,
          
          
            '
          
          
            1111
          
          
            '
          
          
            );
            ConststrNum:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]ofstring[
          
          
            4
          
          
            ]
          
          
            =
          
          
            (
          
          
            '
          
          
            0000
          
          
            '
          
          
            ,
          
          
            '
          
          
            0001
          
          
            '
          
          
            ,
          
          
            '
          
          
            0010
          
          
            '
          
          
            ,
          
          
            '
          
          
            0011
          
          
            '
          
          
            ,
          
          
            '
          
          
            0100
          
          
            '
          
          
            ,
          
          
            '
          
          
            0101
          
          
            '
          
          
            ,
          
          
            '
          
          
            0110
          
          
            '
          
          
            ,
          
          
            '
          
          
            0111
          
          
            '
          
          
            ,
          
          
            '
          
          
            1000
          
          
            '
          
          
            ,
          
          
            '
          
          
            1001
          
          
            '
          
          
            ,
          
          
            '
          
          
            1010
          
          
            '
          
          
            ,
          
          
            '
          
          
            1011
          
          
            '
          
          
            ,
          
          
            '
          
          
            1100
          
          
            '
          
          
            ,
          
          
            '
          
          
            1101
          
          
            '
          
          
            ,
          
          
            '
          
          
            1110
          
          
            '
          
          
            ,
          
          
            '
          
          
            1111
          
          
            '
          
          
            );
            
             ConstchrHex:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]of
          
          
            char
          
          
            =
          
          
            (
          
          
            '
          
          
            0
          
          
            '
          
          
            ,
          
          
            '
          
          
            1
          
          
            '
          
          
            ,
          
          
            '
          
          
            2
          
          
            '
          
          
            ,
          
          
            '
          
          
            3
          
          
            '
          
          
            ,
          
          
            '
          
          
            4
          
          
            '
          
          
            ,
          
          
            '
          
          
            5
          
          
            '
          
          
            ,
          
          
            '
          
          
            6
          
          
            '
          
          
            ,
          
          
            '
          
          
            7
          
          
            '
          
          
            ,
          
          
            '
          
          
            8
          
          
            '
          
          
            ,
          
          
            '
          
          
            9
          
          
            '
          
          
            ,
          
          
            '
          
          
            A
          
          
            '
          
          
            ,
          
          
            '
          
          
            B
          
          
            '
          
          
            ,
          
          
            '
          
          
            C
          
          
            '
          
          
            ,
          
          
            '
          
          
            D
          
          
            '
          
          
            ,
          
          
            '
          
          
            E
          
          
            '
          
          
            ,
          
          
            '
          
          
            F
          
          
            '
          
          
            );
            ConstchrHex:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]of
          
          
            char
          
          
            =
          
          
            (
          
          
            '
          
          
            0
          
          
            '
          
          
            ,
          
          
            '
          
          
            1
          
          
            '
          
          
            ,
          
          
            '
          
          
            2
          
          
            '
          
          
            ,
          
          
            '
          
          
            3
          
          
            '
          
          
            ,
          
          
            '
          
          
            4
          
          
            '
          
          
            ,
          
          
            '
          
          
            5
          
          
            '
          
          
            ,
          
          
            '
          
          
            6
          
          
            '
          
          
            ,
          
          
            '
          
          
            7
          
          
            '
          
          
            ,
          
          
            '
          
          
            8
          
          
            '
          
          
            ,
          
          
            '
          
          
            9
          
          
            '
          
          
            ,
          
          
            '
          
          
            A
          
          
            '
          
          
            ,
          
          
            '
          
          
            B
          
          
            '
          
          
            ,
          
          
            '
          
          
            C
          
          
            '
          
          
            ,
          
          
            '
          
          
            D
          
          
            '
          
          
            ,
          
          
            '
          
          
            E
          
          
            '
          
          
            ,
          
          
            '
          
          
            F
          
          
            '
          
          
            );
            
             var
            var
            
             g_arr_Ten_Password:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofint64;
            g_arr_Ten_Password:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofint64;
            
             g_arr_Flag:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            g_arr_Flag:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            
             g_arr_Table:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            g_arr_Table:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            
             {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
          
            
              {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
            
             
            
             procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
            procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
            
             var
            var
            
             intKey,intLoop1,intLoop2,intLoop3:integer;
            intKey,intLoop1,intLoop2,intLoop3:integer;
            
             hexKey,ch,strTemp:string;
            hexKey,ch,strTemp:string;
            
             strKey:string[
          
          
            128
          
          
            ];
            strKey:string[
          
          
            128
          
          
            ];
            
             begin
            begin
            
             strKey:
          
          
            =
          
          
            ''
          
          
            ;
            strKey:
          
          
            =
          
          
            ''
          
          
            ;
            
             Randomize;
            Randomize;
            
             for
          
          
            intLoop1:
          
          
            =
          
          
            1
          
          
            to
          
          
            8
          
          
          
          
            do
          
          
            for
          
          
            intLoop1:
          
          
            =
          
          
            1
          
          
            to
          
          
            8
          
          
          
          
            do
          
          
            
             begin
            begin
            
             intKey:
          
          
            =
          
          
            Random(
          
          
            65536
          
          
            );
            intKey:
          
          
            =
          
          
            Random(
          
          
            65536
          
          
            );
            
             hexKey:
          
          
            =
          
          
            IntToHex(intKey,
          
          
            4
          
          
            );
            hexKey:
          
          
            =
          
          
            IntToHex(intKey,
          
          
            4
          
          
            );
            
             strTemp:
          
          
            =
          
          
            ''
          
          
            ;
            strTemp:
          
          
            =
          
          
            ''
          
          
            ;
            
             for
          
          
            intLoop2:
          
          
            =
          
          
            1
          
          
            to
          
          
            4
          
          
          
          
            do
          
          
            for
          
          
            intLoop2:
          
          
            =
          
          
            1
          
          
            to
          
          
            4
          
          
          
          
            do
          
          
            
             begin
            begin
            
             ch:
          
          
            =
          
          
            Copy(hexKey,intLoop2,
          
          
            1
          
          
            );
            ch:
          
          
            =
          
          
            Copy(hexKey,intLoop2,
          
          
            1
          
          
            );
            
             for
          
          
            intLoop3:
          
          
            =
          
          
            1
          
          
            to
          
          
            16
          
          
          
          
            do
          
          
            for
          
          
            intLoop3:
          
          
            =
          
          
            1
          
          
            to
          
          
            16
          
          
          
          
            do
          
          
            
             begin
            begin
            
             if
          
          
            ch
          
          
            =
          
          
            chrHex[intLoop3]then
          
          
            if
          
          
            ch
          
          
            =
          
          
            chrHex[intLoop3]then
            
             begin
            begin
            
             ch:
          
          
            =
          
          
            strNum[intLoop3];
            ch:
          
          
            =
          
          
            strNum[intLoop3];
            
             break
          
          
            ;
          
          
            break
          
          
            ;
            
             end;
            end;
            
             end;
            end;
            
             strTemp:
          
          
            =
          
          
            strTemp
          
          
            +
          
          
            ch;
            strTemp:
          
          
            =
          
          
            strTemp
          
          
            +
          
          
            ch;
            
             end;
            end;
            
             strKey:
          
          
            =
          
          
            strKey
          
          
            +
          
          
            strTemp;
            strKey:
          
          
            =
          
          
            strKey
          
          
            +
          
          
            strTemp;
            
             end;
            end;
            
             strOutKey:
          
          
            =
          
          
            strKey;
            strOutKey:
          
          
            =
          
          
            strKey;
            
             CreatePassword(strKey,arrKey,arrOpenKey);
          
          
            //
          
          
            调用产生加密子密钥过程
            CreatePassword(strKey,arrKey,arrOpenKey);
          
          
            //
          
          
            调用产生加密子密钥过程
          
          
            
             end;
          
          
            end;
            
             {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
          
            
              {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
            
             
            
             functionBinToHex(strBin:string):string;
            functionBinToHex(strBin:string):string;
            
             var
            var
            
             intLoop1,intLoop2:integer;
            intLoop1,intLoop2:integer;
            
             strTemp,strResult:string;
            strTemp,strResult:string;
            
             begin
            begin
            
             intLoop1:
          
          
            =
          
          
            1
          
          
            ;
            intLoop1:
          
          
            =
          
          
            1
          
          
            ;
            
             strResult:
          
          
            =
          
          
            ''
          
          
            ;
            strResult:
          
          
            =
          
          
            ''
          
          
            ;
            
             if
          
          
            Length(strBin)
          
          
          
          
          
          
            16
          
          
            thenShowMessage(
          
          
            '
          
          
            二进制数据长度有错!
          
          
            '
          
          
            );
          
          
            if
          
          
            Length(strBin)
          
          
          
          
          
          
            16
          
          
            thenShowMessage(
          
          
            '
          
          
            二进制数据长度有错!
          
          
            '
          
          
            );
            
             while
          
          
            (intLoop1
          
          
            
              16
            
            
              )
            
            
              do
          
          
            while
          
          
            (intLoop1
          
          
            
              16
            
            
              )
            
            
              do
            
            
              
               begin
              begin
              
               strTemp:
            
            
              =
            
            
              Copy(strBin,intLoop1,
            
            
              4
            
            
              );
              strTemp:
            
            
              =
            
            
              Copy(strBin,intLoop1,
            
            
              4
            
            
              );
              
               for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              
               if
            
            
              strTemp
            
            
              =
            
            
              strNum[intLoop2]then
            
            
              if
            
            
              strTemp
            
            
              =
            
            
              strNum[intLoop2]then
              
               begin
              begin
              
               strTemp:
            
            
              =
            
            
              chrHex[intLoop2];
              strTemp:
            
            
              =
            
            
              chrHex[intLoop2];
              
               break
            
            
              ;
            
            
              break
            
            
              ;
              
               end;
              end;
              
               strResult:
            
            
              =
            
            
              strResult
            
            
              +
            
            
              strTemp;
              strResult:
            
            
              =
            
            
              strResult
            
            
              +
            
            
              strTemp;
              
               intLoop1:
            
            
              =
            
            
              intLoop1
            
            
              +
            
            
            
            
              4
            
            
              ;
              intLoop1:
            
            
              =
            
            
              intLoop1
            
            
              +
            
            
            
            
              4
            
            
              ;
              
               end;
              end;
              
               BinToHex:
            
            
              =
            
            
              strResult;
              BinToHex:
            
            
              =
            
            
              strResult;
              
               end;
              end;
              
               {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
            
              
                {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
              
               
              
               functionHexToTen(strHex:string):int64;
            
            
              //
            
            
              十六进制转十进制
              functionHexToTen(strHex:string):int64;
            
            
              //
            
            
              十六进制转十进制
            
            
              
               var
            
            
              var
              
               intLoop1,intLoop2,intTemp:integer;
              intLoop1,intLoop2,intTemp:integer;
              
               intResult:int64;
              intResult:int64;
              
               strTemp:string;
              strTemp:string;
              
               begin
              begin
              
               intResult:
            
            
              =
            
            
              0
            
            
              ;
              intResult:
            
            
              =
            
            
              0
            
            
              ;
              
               intTemp:
            
            
              =
            
            
              0
            
            
              ;
              intTemp:
            
            
              =
            
            
              0
            
            
              ;
              
               if
            
            
              Length(strHex)
            
            
            
            
            
            
              4
            
            
              thenShowMessage(
            
            
              '
            
            
              十六进制数据长度有错!
            
            
              '
            
            
              );
            
            
              if
            
            
              Length(strHex)
            
            
            
            
            
            
              4
            
            
              thenShowMessage(
            
            
              '
            
            
              十六进制数据长度有错!
            
            
              '
            
            
              );
              
               for
            
            
              intLoop1:
            
            
              =
            
            
              1
            
            
              to
            
            
              4
            
            
            
            
              do
            
            
              for
            
            
              intLoop1:
            
            
              =
            
            
              1
            
            
              to
            
            
              4
            
            
            
            
              do
            
            
              
               begin
              begin
              
               CaseintLoop1of
              CaseintLoop1of
              
               1
            
            
              :intTemp:
            
            
              =
            
            
              4096
            
            
              ;
            
            
              1
            
            
              :intTemp:
            
            
              =
            
            
              4096
            
            
              ;
              
               2
            
            
              :intTemp:
            
            
              =
            
            
              256
            
            
              ;
            
            
              2
            
            
              :intTemp:
            
            
              =
            
            
              256
            
            
              ;
              
               3
            
            
              :intTemp:
            
            
              =
            
            
              16
            
            
              ;
            
            
              3
            
            
              :intTemp:
            
            
              =
            
            
              16
            
            
              ;
              
               4
            
            
              :intTemp:
            
            
              =
            
            
              1
            
            
              4
            
            
              :intTemp:
            
            
              =
            
            
              1
            
            
              
               end;
              end;
              
               strTemp:
            
            
              =
            
            
              Copy(strHex,intLoop1,
            
            
              1
            
            
              );
              strTemp:
            
            
              =
            
            
              Copy(strHex,intLoop1,
            
            
              1
            
            
              );
              
               for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              
               if
            
            
              UpperCase(strTemp)
            
            
              =
            
            
              chrHex[intLoop2]then
            
            
              if
            
            
              UpperCase(strTemp)
            
            
              =
            
            
              chrHex[intLoop2]then
              
               begin
              begin
              
               intResult:
            
            
              =
            
            
              intResult
            
            
              +
            
            
              (Int64(intLoop2)
            
            
              -
            
            
            
            
              1
            
            
              )
            
            
              *
            
            
              Int64(intTemp);
              intResult:
            
            
              =
            
            
              intResult
            
            
              +
            
            
              (Int64(intLoop2)
            
            
              -
            
            
            
            
              1
            
            
              )
            
            
              *
            
            
              Int64(intTemp);
              
               break
            
            
              ;
            
            
              break
            
            
              ;
              
               end;
              end;
              
               end;
              end;
              
               HexToTen:
            
            
              =
            
            
              intResult;
              HexToTen:
            
            
              =
            
            
              intResult;
              
               end;
              end;
              
               {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
            
              
                {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
              
               
              
               functionLeftMove(S:string;P:integer):String;
              functionLeftMove(S:string;P:integer):String;
              
               var
              var
              
               int_Len,i:integer;
              int_Len,i:integer;
              
               str_Result,str_Num:string;
              str_Result,str_Num:string;
              
               begin
              begin
              
               int_Len:
            
            
              =
            
            
              length(s);
              int_Len:
            
            
              =
            
            
              length(s);
              
               str_Num:
            
            
              =
            
            
              S;
              str_Num:
            
            
              =
            
            
              S;
              
               str_Result:
            
            
              =
            
            
              ''
            
            
              ;
              str_Result:
            
            
              =
            
            
              ''
            
            
              ;
              
               if
            
            
              int_Len
            
            
              
                Pthen
            
            
              if
            
            
              int_Len
            
            
              
                Pthen
                
                 str_Result:
              
              
                =
              
              
                S
                str_Result:
              
              
                =
              
              
                S
                
                 else
              
              
                else
              
              
                
                 begin
                begin
                
                 for
              
              
                i:
              
              
                =
              
              
                P
              
              
                +
              
              
                1
              
              
                toint_Len
              
              
                do
              
              
                for
              
              
                i:
              
              
                =
              
              
                P
              
              
                +
              
              
                1
              
              
                toint_Len
              
              
                do
              
              
                
                 str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,i,
              
              
                1
              
              
                );
                str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,i,
              
              
                1
              
              
                );
                
                 str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,
              
              
                1
              
              
                ,p);
                str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,
              
              
                1
              
              
                ,p);
                
                 end;
                end;
                
                 LeftMove:
              
              
                =
              
              
                Trim(str_Result);
                LeftMove:
              
              
                =
              
              
                Trim(str_Result);
                
                 end;
                end;
                
                 {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
                
                 
                
                 functionModAdd(intAdd1,intAdd2:int64):int64;
                functionModAdd(intAdd1,intAdd2:int64):int64;
                
                 begin
                begin
                
                 ModAdd:
              
              
                =
              
              
                (intAdd1
              
              
                +
              
              
                intAdd2)mod
              
              
                65536
              
              
                ;
              
              
                //
              
              
                模65536求和
                ModAdd:
              
              
                =
              
              
                (intAdd1
              
              
                +
              
              
                intAdd2)mod
              
              
                65536
              
              
                ;
              
              
                //
              
              
                模65536求和
              
              
                
                 end;
              
              
                end;
                
                 
                
                 functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
                functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
                
                 varintTemp:int64;
                varintTemp:int64;
                
                 begin
                begin
                
                 intTemp:
              
              
                =
              
              
                (intMul1
              
              
                *
              
              
                intMul2)mod
              
              
                65537
              
              
                ;
                intTemp:
              
              
                =
              
              
                (intMul1
              
              
                *
              
              
                intMul2)mod
              
              
                65537
              
              
                ;
                
                 if
              
              
                intFlag
              
              
                =
              
              
              
              
                0
              
              
                then
              
              
                if
              
              
                intFlag
              
              
                =
              
              
              
              
                0
              
              
                then
                
                 begin
                begin
                
                 if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
              
              
                if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
                
                 if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
              
              
                if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
                
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
                
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
                
                 end
                end
                
                 else
              
              
                else
              
              
                
                 begin
                begin
                
                 if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
              
              
                if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
                
                 if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
              
              
                if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
                
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65536
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65536
              
              
                ;
                
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
                
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
                
                 end;
                end;
                
                 ModMul:
              
              
                =
              
              
                intTemp;
                ModMul:
              
              
                =
              
              
                intTemp;
                
                 end;
                end;
                
                 
                
                 functionModXor(intXor1,intXor2:int64):int64;
                functionModXor(intXor1,intXor2:int64):int64;
                
                 begin
                begin
                
                 ModXor:
              
              
                =
              
              
                intXor1xorintXor2;
                ModXor:
              
              
                =
              
              
                intXor1xorintXor2;
                
                 end;
                end;
                
                 {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
                
                 
                
                 procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
                procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
                
                 var
                var
                
                 strKey:string;
                strKey:string;
                
                 strTemp:array[
              
              
                1
              
              
                ..
              
              
                52
              
              
                ]ofstring[
              
              
                4
              
              
                ];
                strTemp:array[
              
              
                1
              
              
                ..
              
              
                52
              
              
                ]ofstring[
              
              
                4
              
              
                ];
                
                 intStart,intCount:integer;
                intStart,intCount:integer;
                
                 begin
                begin
                
                 strKey:
              
              
                =
              
              
                strPassword;
              
              
                //
                strKey:
              
              
                =
              
              
                strPassword;
              
              
                //
                
                 intCount:
              
              
                =
              
              
                1
              
              
                ;
              
              
                intCount:
              
              
                =
              
              
                1
              
              
                ;
                
                 intStart:
              
              
                =
              
              
                1
              
              
                ;
                intStart:
              
              
                =
              
              
                1
              
              
                ;
                
                 {
                
                
                  --------------------
                
                
                  产生52个16bit的加密子密钥部分
                
                
                  -------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------
                
                
                  产生52个16bit的加密子密钥部分
                
                
                  -------------------
                
                
                  }
                
              
              
                
                 while
              
              
                (intCount
              
              
                
                  52
                
                
                  )
                
                
                  do
              
              
                while
              
              
                (intCount
              
              
                
                  52
                
                
                  )
                
                
                  do
                
                
                  
                   begin
                  begin
                  
                   strTemp[intCount]:
                
                
                  =
                
                
                  BinToHex(Copy(strKey,intStart,
                
                
                  16
                
                
                  ));
                  strTemp[intCount]:
                
                
                  =
                
                
                  BinToHex(Copy(strKey,intStart,
                
                
                  16
                
                
                  ));
                  
                   intStart:
                
                
                  =
                
                
                  intStart
                
                
                  +
                
                
                  16
                
                
                  ;
                  intStart:
                
                
                  =
                
                
                  intStart
                
                
                  +
                
                
                  16
                
                
                  ;
                  
                   intCount:
                
                
                  =
                
                
                  intCount
                
                
                  +
                
                
                  1
                
                
                  ;
                  intCount:
                
                
                  =
                
                
                  intCount
                
                
                  +
                
                
                  1
                
                
                  ;
                  
                   if
                
                
                  ((intCountmod
                
                
                  8
                
                
                  )
                
                
                  =
                
                
                
                
                  1
                
                
                  )then
                
                
                  if
                
                
                  ((intCountmod
                
                
                  8
                
                
                  )
                
                
                  =
                
                
                
                
                  1
                
                
                  )then
                  
                   begin
                  begin
                  
                   strKey:
                
                
                  =
                
                
                  LeftMove(strKey,
                
                
                  25
                
                
                  );
                  strKey:
                
                
                  =
                
                
                  LeftMove(strKey,
                
                
                  25
                
                
                  );
                  
                   intStart:
                
                
                  =
                
                
                  1
                
                
                  ;
                  intStart:
                
                
                  =
                
                
                  1
                
                
                  ;
                  
                   end;
                  end;
                  
                   end;
                  end;
                  
                   intCount:
                
                
                  =
                
                
                  1
                
                
                  ;
                  intCount:
                
                
                  =
                
                
                  1
                
                
                  ;
                  
                   while
                
                
                  (intCount
                
                
                  
                    52
                  
                  
                    )
                  
                  
                    do
                
                
                  while
                
                
                  (intCount
                
                
                  
                    52
                  
                  
                    )
                  
                  
                    do
                  
                  
                    
                     begin
                    begin
                    
                     arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ]:
                  
                  
                    =
                  
                  
                    HexToTen(strTemp[intCount]);
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ]:
                  
                  
                    =
                  
                  
                    HexToTen(strTemp[intCount]);
                    
                     g_arr_Ten_Password[intCount]:
                  
                  
                    =
                  
                  
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ];
                    g_arr_Ten_Password[intCount]:
                  
                  
                    =
                  
                  
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ];
                    
                     intCount:
                  
                  
                    =
                  
                  
                    intCount
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    intCount:
                  
                  
                    =
                  
                  
                    intCount
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    
                     end;
                    end;
                    
                     CreateOpenPassword(arrOpenPassword);
                    CreateOpenPassword(arrOpenPassword);
                    
                     {
                    
                    
                      --------------------
                    
                    
                      产生52个16bit的加密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------
                    
                    
                      产生52个16bit的加密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                    
                     end;
                    end;
                    
                     {
                    
                    
                      --------------------------------------------------------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------------------------------------------------------
                    
                    
                      }
                    
                  
                  
                    
                     
                    
                     procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
                    procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
                    
                     var
                    var
                    
                     int_Source,int_Result,int_Mod_Value:int64;
                    int_Source,int_Result,int_Mod_Value:int64;
                    
                     int_Loop:integer;
                    int_Loop:integer;
                    
                     begin
                    begin
                    
                     int_Source:
                  
                  
                    =
                  
                  
                    intSource;
                    int_Source:
                  
                  
                    =
                  
                  
                    intSource;
                    
                     {
                    
                    
                      --------------------
                    
                    
                      求取每个加密子密钥相应的解密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------
                    
                    
                      求取每个加密子密钥相应的解密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                    
                     CaseFlagof
                    CaseFlagof
                    
                     0
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    int_Source;
                  
                  
                    0
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    int_Source;
                    
                     1
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    65536
                  
                  
                    -
                  
                  
                    int_Source;
                  
                  
                    1
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    65536
                  
                  
                    -
                  
                  
                    int_Source;
                    
                     2
                  
                  
                    :
                  
                  
                    2
                  
                  
                    :
                    
                     begin
                    begin
                    
                     if
                  
                  
                    int_Source
                  
                  
                    =
                  
                  
                    0
                  
                  
                    then
                  
                  
                    if
                  
                  
                    int_Source
                  
                  
                    =
                  
                  
                    0
                  
                  
                    then
                    
                     intResult:
                  
                  
                    =
                  
                  
                    int_Source
                    intResult:
                  
                  
                    =
                  
                  
                    int_Source
                    
                     else
                  
                  
                    else
                  
                  
                    
                     for
                  
                  
                    int_Loop:
                  
                  
                    =
                  
                  
                    1
                  
                  
                    to
                  
                  
                    65536
                  
                  
                  
                  
                    do
                  
                  
                    for
                  
                  
                    int_Loop:
                  
                  
                    =
                  
                  
                    1
                  
                  
                    to
                  
                  
                    65536
                  
                  
                  
                  
                    do
                  
                  
                    
                     begin
                    begin
                    
                     int_Result:
                  
                  
                    =
                  
                  
                    Int64(int_Loop)
                  
                  
                    *
                  
                  
                    65537
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    int_Result:
                  
                  
                    =
                  
                  
                    Int64(int_Loop)
                  
                  
                    *
                  
                  
                    65537
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    
                     int_Mod_Value:
                  
                  
                    =
                  
                  
                    int_Resultmodint_Source;
                    int_Mod_Value:
                  
                  
                    =
                  
                  
                    int_Resultmodint_Source;
                    
                     if
                  
                  
                    int_Mod_Value
                  
                  
                    =
                  
                  
                  
                  
                    0
                  
                  
                    then
                  
                  
                    if
                  
                  
                    int_Mod_Value
                  
                  
                    =
                  
                  
                  
                  
                    0
                  
                  
                    then
                    
                     begin
                    begin
                    
                     int_Result:
                  
                  
                    =
                  
                  
                    int_Resultdivint_Source;
                    int_Result:
                  
                  
                    =
                  
                  
                    int_Resultdivint_Source;
                    
                     intResult:
                  
                  
                    =
                  
                  
                    int_Result;
                    intResult:
                  
                  
                    =
                  
                  
                    int_Result;
                    
                     break
                  
                  
                    ;
                  
                  
                    break
                  
                  
                    ;
                    
                     en
                    en 
                  
                
              
            
          
        
      
      
      
        
      
      
      
      
        
    
    
  
  
    
    
    
    
      
    
    
    
    
    
      
    
    
  
  
 
       IDEA数据加密算法介绍之续篇,代码实现:
      
      
        http://blog.csdn.net/CXXSoft/archive/2006/08/23/1109279.aspx
      
    
5、 源码:
 //
        
        
          *******************************************************************************
        
          //
        
        
          *******************************************************************************
        
        
           *
        
        
          IDEA数据加密算法1.0版本
        
        
        
        
          *
        
        
          IDEA数据加密算法1.0版本
           *
        
        
          开发作者:成晓旭
        
        
          *
        
        
          开发作者:成晓旭
           *
        
        
          项目简述:IDEA数据加密算法1.0版本
        
        
          *
        
        
          项目简述:IDEA数据加密算法1.0版本
           *
        
        
          启动时间:2000年05月08日
        
        
          *
        
        
          启动时间:2000年05月08日
           *
        
        
          完成时间:2000年01月14日
        
        
          20
        
        
          :
        
        
          09
        
        
          :
        
        
          00
        
        
        
        
          
            1个晚上
          
          
            >
        
        
          *
        
        
          完成时间:2000年01月14日
        
        
          20
        
        
          :
        
        
          09
        
        
          :
        
        
          00
        
        
        
        
          
            1个晚上
          
          
            >
          
          
             *
          
          
            *
          
          
             *
          
          
            开发环境:Windows98
          
          
            *
          
          
            开发环境:Windows98
             *
          
          
            开发工具:BorlandDelphi5
          
          
            *
          
          
            开发工具:BorlandDelphi5
             *
          
          
            *
          
          
             *
          
          
            文件名称:IDEA.pas
          
          
            *
          
          
            文件名称:IDEA.pas
             *
          
          
            简介:IDEA数据加密算法1.0版本
          
          
            *
          
          
            简介:IDEA数据加密算法1.0版本
             *
          
          
            *
          
          
             *
          
          
            备注:任何人使用此文件时,请保留此段自述文件,谢谢
          
          
            !
          
          
            *
          
          
            备注:任何人使用此文件时,请保留此段自述文件,谢谢
          
          
            !
          
          
             *
          
          
            *
          
          
             ******************************************************************************/
          
          
            ******************************************************************************/
          
          
             unitIDEA;
            unitIDEA;
             
             interface
          
          
            interface
          
          
             
             uses
            uses
             Windows,Messages,SysUtils,Classes,Dialogs;
            Windows,Messages,SysUtils,Classes,Dialogs;
             functionBinToHex(strBin:string):string;
            functionBinToHex(strBin:string):string;
             functionHexToTen(strHex:string):int64;
            functionHexToTen(strHex:string):int64;
             functionLeftMove(S:string;P:integer):String;
            functionLeftMove(S:string;P:integer):String;
             functionModAdd(intAdd1,intAdd2:int64):int64;
            functionModAdd(intAdd1,intAdd2:int64):int64;
             functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
            functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
             functionModXor(intXor1,intXor2:int64):int64;
            functionModXor(intXor1,intXor2:int64):int64;
             procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
          
          
            //
          
          
            产生加密子密钥函数
            procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
          
          
            //
          
          
            产生加密子密钥函数
          
          
             procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
          
          
            //
          
          
            求取解密子密钥函数
          
          
            procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
          
          
            //
          
          
            求取解密子密钥函数
          
          
             procedureCreateKeyTable();
          
          
            //
          
          
            产生加、解密子密钥之间的对应关系表
          
          
            procedureCreateKeyTable();
          
          
            //
          
          
            产生加、解密子密钥之间的对应关系表
          
          
             procedureRiddle(arrPassword:arrayofint64;arrRiddleKey:arrayofint64;VARarrOpenPassword:arrayofint64);StdCall;export;
          
          
            //
          
          
            IDEA数据解密函数
          
          
            procedureRiddle(arrPassword:arrayofint64;arrRiddleKey:arrayofint64;VARarrOpenPassword:arrayofint64);StdCall;export;
          
          
            //
          
          
            IDEA数据解密函数
          
          
             procedureCreateOpenPassword(VARarrOpenPassKey:arrayofint64);
          
          
            //
          
          
            产生解密子密钥函数
          
          
            procedureCreateOpenPassword(VARarrOpenPassKey:arrayofint64);
          
          
            //
          
          
            产生解密子密钥函数
          
          
             procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
          
          
            //
          
          
            产生加密密钥函数
          
          
            procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
          
          
            //
          
          
            产生加密密钥函数
          
          
             
          
          
             
             implementation
            implementation
             
             ConststrNum:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]ofstring[
          
          
            4
          
          
            ]
          
          
            =
          
          
            (
          
          
            '
          
          
            0000
          
          
            '
          
          
            ,
          
          
            '
          
          
            0001
          
          
            '
          
          
            ,
          
          
            '
          
          
            0010
          
          
            '
          
          
            ,
          
          
            '
          
          
            0011
          
          
            '
          
          
            ,
          
          
            '
          
          
            0100
          
          
            '
          
          
            ,
          
          
            '
          
          
            0101
          
          
            '
          
          
            ,
          
          
            '
          
          
            0110
          
          
            '
          
          
            ,
          
          
            '
          
          
            0111
          
          
            '
          
          
            ,
          
          
            '
          
          
            1000
          
          
            '
          
          
            ,
          
          
            '
          
          
            1001
          
          
            '
          
          
            ,
          
          
            '
          
          
            1010
          
          
            '
          
          
            ,
          
          
            '
          
          
            1011
          
          
            '
          
          
            ,
          
          
            '
          
          
            1100
          
          
            '
          
          
            ,
          
          
            '
          
          
            1101
          
          
            '
          
          
            ,
          
          
            '
          
          
            1110
          
          
            '
          
          
            ,
          
          
            '
          
          
            1111
          
          
            '
          
          
            );
            ConststrNum:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]ofstring[
          
          
            4
          
          
            ]
          
          
            =
          
          
            (
          
          
            '
          
          
            0000
          
          
            '
          
          
            ,
          
          
            '
          
          
            0001
          
          
            '
          
          
            ,
          
          
            '
          
          
            0010
          
          
            '
          
          
            ,
          
          
            '
          
          
            0011
          
          
            '
          
          
            ,
          
          
            '
          
          
            0100
          
          
            '
          
          
            ,
          
          
            '
          
          
            0101
          
          
            '
          
          
            ,
          
          
            '
          
          
            0110
          
          
            '
          
          
            ,
          
          
            '
          
          
            0111
          
          
            '
          
          
            ,
          
          
            '
          
          
            1000
          
          
            '
          
          
            ,
          
          
            '
          
          
            1001
          
          
            '
          
          
            ,
          
          
            '
          
          
            1010
          
          
            '
          
          
            ,
          
          
            '
          
          
            1011
          
          
            '
          
          
            ,
          
          
            '
          
          
            1100
          
          
            '
          
          
            ,
          
          
            '
          
          
            1101
          
          
            '
          
          
            ,
          
          
            '
          
          
            1110
          
          
            '
          
          
            ,
          
          
            '
          
          
            1111
          
          
            '
          
          
            );
             ConstchrHex:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]of
          
          
            char
          
          
            =
          
          
            (
          
          
            '
          
          
            0
          
          
            '
          
          
            ,
          
          
            '
          
          
            1
          
          
            '
          
          
            ,
          
          
            '
          
          
            2
          
          
            '
          
          
            ,
          
          
            '
          
          
            3
          
          
            '
          
          
            ,
          
          
            '
          
          
            4
          
          
            '
          
          
            ,
          
          
            '
          
          
            5
          
          
            '
          
          
            ,
          
          
            '
          
          
            6
          
          
            '
          
          
            ,
          
          
            '
          
          
            7
          
          
            '
          
          
            ,
          
          
            '
          
          
            8
          
          
            '
          
          
            ,
          
          
            '
          
          
            9
          
          
            '
          
          
            ,
          
          
            '
          
          
            A
          
          
            '
          
          
            ,
          
          
            '
          
          
            B
          
          
            '
          
          
            ,
          
          
            '
          
          
            C
          
          
            '
          
          
            ,
          
          
            '
          
          
            D
          
          
            '
          
          
            ,
          
          
            '
          
          
            E
          
          
            '
          
          
            ,
          
          
            '
          
          
            F
          
          
            '
          
          
            );
            ConstchrHex:array[
          
          
            1
          
          
            ..
          
          
            16
          
          
            ]of
          
          
            char
          
          
            =
          
          
            (
          
          
            '
          
          
            0
          
          
            '
          
          
            ,
          
          
            '
          
          
            1
          
          
            '
          
          
            ,
          
          
            '
          
          
            2
          
          
            '
          
          
            ,
          
          
            '
          
          
            3
          
          
            '
          
          
            ,
          
          
            '
          
          
            4
          
          
            '
          
          
            ,
          
          
            '
          
          
            5
          
          
            '
          
          
            ,
          
          
            '
          
          
            6
          
          
            '
          
          
            ,
          
          
            '
          
          
            7
          
          
            '
          
          
            ,
          
          
            '
          
          
            8
          
          
            '
          
          
            ,
          
          
            '
          
          
            9
          
          
            '
          
          
            ,
          
          
            '
          
          
            A
          
          
            '
          
          
            ,
          
          
            '
          
          
            B
          
          
            '
          
          
            ,
          
          
            '
          
          
            C
          
          
            '
          
          
            ,
          
          
            '
          
          
            D
          
          
            '
          
          
            ,
          
          
            '
          
          
            E
          
          
            '
          
          
            ,
          
          
            '
          
          
            F
          
          
            '
          
          
            );
             var
            var
             g_arr_Ten_Password:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofint64;
            g_arr_Ten_Password:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofint64;
             g_arr_Flag:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            g_arr_Flag:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
             g_arr_Table:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
            g_arr_Table:array[
          
          
            1
          
          
            ..
          
          
            52
          
          
            ]ofinteger;
             {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
          
            
              {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
             
             procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
            procedureCreateKey(VARarrKey:arrayofint64;VARarrOpenKey:arrayofint64;VARstrOutKey:string);StdCall;export;
             var
            var
             intKey,intLoop1,intLoop2,intLoop3:integer;
            intKey,intLoop1,intLoop2,intLoop3:integer;
             hexKey,ch,strTemp:string;
            hexKey,ch,strTemp:string;
             strKey:string[
          
          
            128
          
          
            ];
            strKey:string[
          
          
            128
          
          
            ];
             begin
            begin
             strKey:
          
          
            =
          
          
            ''
          
          
            ;
            strKey:
          
          
            =
          
          
            ''
          
          
            ;
             Randomize;
            Randomize;
             for
          
          
            intLoop1:
          
          
            =
          
          
            1
          
          
            to
          
          
            8
          
          
          
          
            do
          
          
            for
          
          
            intLoop1:
          
          
            =
          
          
            1
          
          
            to
          
          
            8
          
          
          
          
            do
          
          
             begin
            begin
             intKey:
          
          
            =
          
          
            Random(
          
          
            65536
          
          
            );
            intKey:
          
          
            =
          
          
            Random(
          
          
            65536
          
          
            );
             hexKey:
          
          
            =
          
          
            IntToHex(intKey,
          
          
            4
          
          
            );
            hexKey:
          
          
            =
          
          
            IntToHex(intKey,
          
          
            4
          
          
            );
             strTemp:
          
          
            =
          
          
            ''
          
          
            ;
            strTemp:
          
          
            =
          
          
            ''
          
          
            ;
             for
          
          
            intLoop2:
          
          
            =
          
          
            1
          
          
            to
          
          
            4
          
          
          
          
            do
          
          
            for
          
          
            intLoop2:
          
          
            =
          
          
            1
          
          
            to
          
          
            4
          
          
          
          
            do
          
          
             begin
            begin
             ch:
          
          
            =
          
          
            Copy(hexKey,intLoop2,
          
          
            1
          
          
            );
            ch:
          
          
            =
          
          
            Copy(hexKey,intLoop2,
          
          
            1
          
          
            );
             for
          
          
            intLoop3:
          
          
            =
          
          
            1
          
          
            to
          
          
            16
          
          
          
          
            do
          
          
            for
          
          
            intLoop3:
          
          
            =
          
          
            1
          
          
            to
          
          
            16
          
          
          
          
            do
          
          
             begin
            begin
             if
          
          
            ch
          
          
            =
          
          
            chrHex[intLoop3]then
          
          
            if
          
          
            ch
          
          
            =
          
          
            chrHex[intLoop3]then
             begin
            begin
             ch:
          
          
            =
          
          
            strNum[intLoop3];
            ch:
          
          
            =
          
          
            strNum[intLoop3];
             break
          
          
            ;
          
          
            break
          
          
            ;
             end;
            end;
             end;
            end;
             strTemp:
          
          
            =
          
          
            strTemp
          
          
            +
          
          
            ch;
            strTemp:
          
          
            =
          
          
            strTemp
          
          
            +
          
          
            ch;
             end;
            end;
             strKey:
          
          
            =
          
          
            strKey
          
          
            +
          
          
            strTemp;
            strKey:
          
          
            =
          
          
            strKey
          
          
            +
          
          
            strTemp;
             end;
            end;
             strOutKey:
          
          
            =
          
          
            strKey;
            strOutKey:
          
          
            =
          
          
            strKey;
             CreatePassword(strKey,arrKey,arrOpenKey);
          
          
            //
          
          
            调用产生加密子密钥过程
            CreatePassword(strKey,arrKey,arrOpenKey);
          
          
            //
          
          
            调用产生加密子密钥过程
          
          
             end;
          
          
            end;
             {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
          
            
              {
            
            
              --------------------------------------------------------------------
            
            
              }
            
          
          
             
             functionBinToHex(strBin:string):string;
            functionBinToHex(strBin:string):string;
             var
            var
             intLoop1,intLoop2:integer;
            intLoop1,intLoop2:integer;
             strTemp,strResult:string;
            strTemp,strResult:string;
             begin
            begin
             intLoop1:
          
          
            =
          
          
            1
          
          
            ;
            intLoop1:
          
          
            =
          
          
            1
          
          
            ;
             strResult:
          
          
            =
          
          
            ''
          
          
            ;
            strResult:
          
          
            =
          
          
            ''
          
          
            ;
             if
          
          
            Length(strBin)
          
          
          
          
          
          
            16
          
          
            thenShowMessage(
          
          
            '
          
          
            二进制数据长度有错!
          
          
            '
          
          
            );
          
          
            if
          
          
            Length(strBin)
          
          
          
          
          
          
            16
          
          
            thenShowMessage(
          
          
            '
          
          
            二进制数据长度有错!
          
          
            '
          
          
            );
             while
          
          
            (intLoop1
          
          
            
              16
            
            
              )
            
            
              do
          
          
            while
          
          
            (intLoop1
          
          
            
              16
            
            
              )
            
            
              do
            
            
               begin
              begin
               strTemp:
            
            
              =
            
            
              Copy(strBin,intLoop1,
            
            
              4
            
            
              );
              strTemp:
            
            
              =
            
            
              Copy(strBin,intLoop1,
            
            
              4
            
            
              );
               for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
               if
            
            
              strTemp
            
            
              =
            
            
              strNum[intLoop2]then
            
            
              if
            
            
              strTemp
            
            
              =
            
            
              strNum[intLoop2]then
               begin
              begin
               strTemp:
            
            
              =
            
            
              chrHex[intLoop2];
              strTemp:
            
            
              =
            
            
              chrHex[intLoop2];
               break
            
            
              ;
            
            
              break
            
            
              ;
               end;
              end;
               strResult:
            
            
              =
            
            
              strResult
            
            
              +
            
            
              strTemp;
              strResult:
            
            
              =
            
            
              strResult
            
            
              +
            
            
              strTemp;
               intLoop1:
            
            
              =
            
            
              intLoop1
            
            
              +
            
            
            
            
              4
            
            
              ;
              intLoop1:
            
            
              =
            
            
              intLoop1
            
            
              +
            
            
            
            
              4
            
            
              ;
               end;
              end;
               BinToHex:
            
            
              =
            
            
              strResult;
              BinToHex:
            
            
              =
            
            
              strResult;
               end;
              end;
               {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
            
              
                {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
               
               functionHexToTen(strHex:string):int64;
            
            
              //
            
            
              十六进制转十进制
              functionHexToTen(strHex:string):int64;
            
            
              //
            
            
              十六进制转十进制
            
            
               var
            
            
              var
               intLoop1,intLoop2,intTemp:integer;
              intLoop1,intLoop2,intTemp:integer;
               intResult:int64;
              intResult:int64;
               strTemp:string;
              strTemp:string;
               begin
              begin
               intResult:
            
            
              =
            
            
              0
            
            
              ;
              intResult:
            
            
              =
            
            
              0
            
            
              ;
               intTemp:
            
            
              =
            
            
              0
            
            
              ;
              intTemp:
            
            
              =
            
            
              0
            
            
              ;
               if
            
            
              Length(strHex)
            
            
            
            
            
            
              4
            
            
              thenShowMessage(
            
            
              '
            
            
              十六进制数据长度有错!
            
            
              '
            
            
              );
            
            
              if
            
            
              Length(strHex)
            
            
            
            
            
            
              4
            
            
              thenShowMessage(
            
            
              '
            
            
              十六进制数据长度有错!
            
            
              '
            
            
              );
               for
            
            
              intLoop1:
            
            
              =
            
            
              1
            
            
              to
            
            
              4
            
            
            
            
              do
            
            
              for
            
            
              intLoop1:
            
            
              =
            
            
              1
            
            
              to
            
            
              4
            
            
            
            
              do
            
            
               begin
              begin
               CaseintLoop1of
              CaseintLoop1of
               1
            
            
              :intTemp:
            
            
              =
            
            
              4096
            
            
              ;
            
            
              1
            
            
              :intTemp:
            
            
              =
            
            
              4096
            
            
              ;
               2
            
            
              :intTemp:
            
            
              =
            
            
              256
            
            
              ;
            
            
              2
            
            
              :intTemp:
            
            
              =
            
            
              256
            
            
              ;
               3
            
            
              :intTemp:
            
            
              =
            
            
              16
            
            
              ;
            
            
              3
            
            
              :intTemp:
            
            
              =
            
            
              16
            
            
              ;
               4
            
            
              :intTemp:
            
            
              =
            
            
              1
            
            
              4
            
            
              :intTemp:
            
            
              =
            
            
              1
            
            
               end;
              end;
               strTemp:
            
            
              =
            
            
              Copy(strHex,intLoop1,
            
            
              1
            
            
              );
              strTemp:
            
            
              =
            
            
              Copy(strHex,intLoop1,
            
            
              1
            
            
              );
               for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
              for
            
            
              intLoop2:
            
            
              =
            
            
              1
            
            
              to
            
            
              16
            
            
            
            
              do
            
            
               if
            
            
              UpperCase(strTemp)
            
            
              =
            
            
              chrHex[intLoop2]then
            
            
              if
            
            
              UpperCase(strTemp)
            
            
              =
            
            
              chrHex[intLoop2]then
               begin
              begin
               intResult:
            
            
              =
            
            
              intResult
            
            
              +
            
            
              (Int64(intLoop2)
            
            
              -
            
            
            
            
              1
            
            
              )
            
            
              *
            
            
              Int64(intTemp);
              intResult:
            
            
              =
            
            
              intResult
            
            
              +
            
            
              (Int64(intLoop2)
            
            
              -
            
            
            
            
              1
            
            
              )
            
            
              *
            
            
              Int64(intTemp);
               break
            
            
              ;
            
            
              break
            
            
              ;
               end;
              end;
               end;
              end;
               HexToTen:
            
            
              =
            
            
              intResult;
              HexToTen:
            
            
              =
            
            
              intResult;
               end;
              end;
               {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
            
              
                {
              
              
                --------------------------------------------------------------------
              
              
                }
              
            
            
               
               functionLeftMove(S:string;P:integer):String;
              functionLeftMove(S:string;P:integer):String;
               var
              var
               int_Len,i:integer;
              int_Len,i:integer;
               str_Result,str_Num:string;
              str_Result,str_Num:string;
               begin
              begin
               int_Len:
            
            
              =
            
            
              length(s);
              int_Len:
            
            
              =
            
            
              length(s);
               str_Num:
            
            
              =
            
            
              S;
              str_Num:
            
            
              =
            
            
              S;
               str_Result:
            
            
              =
            
            
              ''
            
            
              ;
              str_Result:
            
            
              =
            
            
              ''
            
            
              ;
               if
            
            
              int_Len
            
            
              
                Pthen
            
            
              if
            
            
              int_Len
            
            
              
                Pthen
                 str_Result:
              
              
                =
              
              
                S
                str_Result:
              
              
                =
              
              
                S
                 else
              
              
                else
              
              
                 begin
                begin
                 for
              
              
                i:
              
              
                =
              
              
                P
              
              
                +
              
              
                1
              
              
                toint_Len
              
              
                do
              
              
                for
              
              
                i:
              
              
                =
              
              
                P
              
              
                +
              
              
                1
              
              
                toint_Len
              
              
                do
              
              
                 str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,i,
              
              
                1
              
              
                );
                str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,i,
              
              
                1
              
              
                );
                 str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,
              
              
                1
              
              
                ,p);
                str_Result:
              
              
                =
              
              
                str_Result
              
              
                +
              
              
                copy(str_Num,
              
              
                1
              
              
                ,p);
                 end;
                end;
                 LeftMove:
              
              
                =
              
              
                Trim(str_Result);
                LeftMove:
              
              
                =
              
              
                Trim(str_Result);
                 end;
                end;
                 {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
                 
                 functionModAdd(intAdd1,intAdd2:int64):int64;
                functionModAdd(intAdd1,intAdd2:int64):int64;
                 begin
                begin
                 ModAdd:
              
              
                =
              
              
                (intAdd1
              
              
                +
              
              
                intAdd2)mod
              
              
                65536
              
              
                ;
              
              
                //
              
              
                模65536求和
                ModAdd:
              
              
                =
              
              
                (intAdd1
              
              
                +
              
              
                intAdd2)mod
              
              
                65536
              
              
                ;
              
              
                //
              
              
                模65536求和
              
              
                 end;
              
              
                end;
                 
                 functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
                functionModMul(intMul1,intMul2:int64;intFlag:integer):int64;
                 varintTemp:int64;
                varintTemp:int64;
                 begin
                begin
                 intTemp:
              
              
                =
              
              
                (intMul1
              
              
                *
              
              
                intMul2)mod
              
              
                65537
              
              
                ;
                intTemp:
              
              
                =
              
              
                (intMul1
              
              
                *
              
              
                intMul2)mod
              
              
                65537
              
              
                ;
                 if
              
              
                intFlag
              
              
                =
              
              
              
              
                0
              
              
                then
              
              
                if
              
              
                intFlag
              
              
                =
              
              
              
              
                0
              
              
                then
                 begin
                begin
                 if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
              
              
                if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
                 if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
              
              
                if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
                 end
                end
                 else
              
              
                else
              
              
                 begin
                begin
                 if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
              
              
                if
              
              
                intMul1
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul2;
                 if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
              
              
                if
              
              
                intMul2
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65537
              
              
              
              
                -
              
              
                intMul1;
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65536
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                0
              
              
                thenintTemp:
              
              
                =
              
              
                65536
              
              
                ;
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65537
              
              
                thenintTemp:
              
              
                =
              
              
                1
              
              
                ;
                 if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
              
              
                if
              
              
                intTemp
              
              
                =
              
              
              
              
                65536
              
              
                thenintTemp:
              
              
                =
              
              
                0
              
              
                ;
                 end;
                end;
                 ModMul:
              
              
                =
              
              
                intTemp;
                ModMul:
              
              
                =
              
              
                intTemp;
                 end;
                end;
                 
                 functionModXor(intXor1,intXor2:int64):int64;
                functionModXor(intXor1,intXor2:int64):int64;
                 begin
                begin
                 ModXor:
              
              
                =
              
              
                intXor1xorintXor2;
                ModXor:
              
              
                =
              
              
                intXor1xorintXor2;
                 end;
                end;
                 {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------------------------------------------------------
                
                
                  }
                
              
              
                 
                 procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
                procedureCreatePassword(strPassword:string;VARarrPassword:arrayofint64;VARarrOpenPassword:arrayofint64);
                 var
                var
                 strKey:string;
                strKey:string;
                 strTemp:array[
              
              
                1
              
              
                ..
              
              
                52
              
              
                ]ofstring[
              
              
                4
              
              
                ];
                strTemp:array[
              
              
                1
              
              
                ..
              
              
                52
              
              
                ]ofstring[
              
              
                4
              
              
                ];
                 intStart,intCount:integer;
                intStart,intCount:integer;
                 begin
                begin
                 strKey:
              
              
                =
              
              
                strPassword;
              
              
                //
                strKey:
              
              
                =
              
              
                strPassword;
              
              
                //
                 intCount:
              
              
                =
              
              
                1
              
              
                ;
              
              
                intCount:
              
              
                =
              
              
                1
              
              
                ;
                 intStart:
              
              
                =
              
              
                1
              
              
                ;
                intStart:
              
              
                =
              
              
                1
              
              
                ;
                 {
                
                
                  --------------------
                
                
                  产生52个16bit的加密子密钥部分
                
                
                  -------------------
                
                
                  }
                
              
              
              
                
                  {
                
                
                  --------------------
                
                
                  产生52个16bit的加密子密钥部分
                
                
                  -------------------
                
                
                  }
                
              
              
                 while
              
              
                (intCount
              
              
                
                  52
                
                
                  )
                
                
                  do
              
              
                while
              
              
                (intCount
              
              
                
                  52
                
                
                  )
                
                
                  do
                
                
                   begin
                  begin
                   strTemp[intCount]:
                
                
                  =
                
                
                  BinToHex(Copy(strKey,intStart,
                
                
                  16
                
                
                  ));
                  strTemp[intCount]:
                
                
                  =
                
                
                  BinToHex(Copy(strKey,intStart,
                
                
                  16
                
                
                  ));
                   intStart:
                
                
                  =
                
                
                  intStart
                
                
                  +
                
                
                  16
                
                
                  ;
                  intStart:
                
                
                  =
                
                
                  intStart
                
                
                  +
                
                
                  16
                
                
                  ;
                   intCount:
                
                
                  =
                
                
                  intCount
                
                
                  +
                
                
                  1
                
                
                  ;
                  intCount:
                
                
                  =
                
                
                  intCount
                
                
                  +
                
                
                  1
                
                
                  ;
                   if
                
                
                  ((intCountmod
                
                
                  8
                
                
                  )
                
                
                  =
                
                
                
                
                  1
                
                
                  )then
                
                
                  if
                
                
                  ((intCountmod
                
                
                  8
                
                
                  )
                
                
                  =
                
                
                
                
                  1
                
                
                  )then
                   begin
                  begin
                   strKey:
                
                
                  =
                
                
                  LeftMove(strKey,
                
                
                  25
                
                
                  );
                  strKey:
                
                
                  =
                
                
                  LeftMove(strKey,
                
                
                  25
                
                
                  );
                   intStart:
                
                
                  =
                
                
                  1
                
                
                  ;
                  intStart:
                
                
                  =
                
                
                  1
                
                
                  ;
                   end;
                  end;
                   end;
                  end;
                   intCount:
                
                
                  =
                
                
                  1
                
                
                  ;
                  intCount:
                
                
                  =
                
                
                  1
                
                
                  ;
                   while
                
                
                  (intCount
                
                
                  
                    52
                  
                  
                    )
                  
                  
                    do
                
                
                  while
                
                
                  (intCount
                
                
                  
                    52
                  
                  
                    )
                  
                  
                    do
                  
                  
                     begin
                    begin
                     arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ]:
                  
                  
                    =
                  
                  
                    HexToTen(strTemp[intCount]);
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ]:
                  
                  
                    =
                  
                  
                    HexToTen(strTemp[intCount]);
                     g_arr_Ten_Password[intCount]:
                  
                  
                    =
                  
                  
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ];
                    g_arr_Ten_Password[intCount]:
                  
                  
                    =
                  
                  
                    arrPassword[intCount
                  
                  
                    -
                  
                  
                    1
                  
                  
                    ];
                     intCount:
                  
                  
                    =
                  
                  
                    intCount
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    intCount:
                  
                  
                    =
                  
                  
                    intCount
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                     end;
                    end;
                     CreateOpenPassword(arrOpenPassword);
                    CreateOpenPassword(arrOpenPassword);
                     {
                    
                    
                      --------------------
                    
                    
                      产生52个16bit的加密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------
                    
                    
                      产生52个16bit的加密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                     end;
                    end;
                     {
                    
                    
                      --------------------------------------------------------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------------------------------------------------------
                    
                    
                      }
                    
                  
                  
                     
                     procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
                    procedureGetOpenPassword(intSource:int64;VARintResult:int64;Flag:integer);
                     var
                    var
                     int_Source,int_Result,int_Mod_Value:int64;
                    int_Source,int_Result,int_Mod_Value:int64;
                     int_Loop:integer;
                    int_Loop:integer;
                     begin
                    begin
                     int_Source:
                  
                  
                    =
                  
                  
                    intSource;
                    int_Source:
                  
                  
                    =
                  
                  
                    intSource;
                     {
                    
                    
                      --------------------
                    
                    
                      求取每个加密子密钥相应的解密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                  
                    
                      {
                    
                    
                      --------------------
                    
                    
                      求取每个加密子密钥相应的解密子密钥部分
                    
                    
                      -------------------
                    
                    
                      }
                    
                  
                  
                     CaseFlagof
                    CaseFlagof
                     0
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    int_Source;
                  
                  
                    0
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    int_Source;
                     1
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    65536
                  
                  
                    -
                  
                  
                    int_Source;
                  
                  
                    1
                  
                  
                    :intResult:
                  
                  
                    =
                  
                  
                    65536
                  
                  
                    -
                  
                  
                    int_Source;
                     2
                  
                  
                    :
                  
                  
                    2
                  
                  
                    :
                     begin
                    begin
                     if
                  
                  
                    int_Source
                  
                  
                    =
                  
                  
                    0
                  
                  
                    then
                  
                  
                    if
                  
                  
                    int_Source
                  
                  
                    =
                  
                  
                    0
                  
                  
                    then
                     intResult:
                  
                  
                    =
                  
                  
                    int_Source
                    intResult:
                  
                  
                    =
                  
                  
                    int_Source
                     else
                  
                  
                    else
                  
                  
                     for
                  
                  
                    int_Loop:
                  
                  
                    =
                  
                  
                    1
                  
                  
                    to
                  
                  
                    65536
                  
                  
                  
                  
                    do
                  
                  
                    for
                  
                  
                    int_Loop:
                  
                  
                    =
                  
                  
                    1
                  
                  
                    to
                  
                  
                    65536
                  
                  
                  
                  
                    do
                  
                  
                     begin
                    begin
                     int_Result:
                  
                  
                    =
                  
                  
                    Int64(int_Loop)
                  
                  
                    *
                  
                  
                    65537
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                    int_Result:
                  
                  
                    =
                  
                  
                    Int64(int_Loop)
                  
                  
                    *
                  
                  
                    65537
                  
                  
                    +
                  
                  
                    1
                  
                  
                    ;
                     int_Mod_Value:
                  
                  
                    =
                  
                  
                    int_Resultmodint_Source;
                    int_Mod_Value:
                  
                  
                    =
                  
                  
                    int_Resultmodint_Source;
                     if
                  
                  
                    int_Mod_Value
                  
                  
                    =
                  
                  
                  
                  
                    0
                  
                  
                    then
                  
                  
                    if
                  
                  
                    int_Mod_Value
                  
                  
                    =
                  
                  
                  
                  
                    0
                  
                  
                    then
                     begin
                    begin
                     int_Result:
                  
                  
                    =
                  
                  
                    int_Resultdivint_Source;
                    int_Result:
                  
                  
                    =
                  
                  
                    int_Resultdivint_Source;
                     intResult:
                  
                  
                    =
                  
                  
                    int_Result;
                    intResult:
                  
                  
                    =
                  
                  
                    int_Result;
                     break
                  
                  
                    ;
                  
                  
                    break
                  
                  
                    ;
                     en
                    en 
                  
                
              
            
          
        
      发表评论
- 浏览: 1292487 次
- 
          性别: 
            
- 来自: 杭州
- 
            
最新评论
- 
          
            netkongjian
          
          : 不错的软件知识,感谢分享!
          
 软件加密方式
- 
          
            norce
          
          : 效果不错~
          
 JS实现图片幻灯片效果
- 
          
            zxbear
          
          : 链接已失效
          
 《jQuery基础教程:第2版》PDF
- 
          
            架构师
          
          : 在技术领域方面Java还是世界上最好的,而且有很多第三方控件的 ...
          
 专访:Ruby能否成为第二个Java
- 
          
            freddie
          
          : 如何拖动表格边框调整行高和列宽?
          
 可编辑的表格(JavaScript)


 
           
           
           
           
         
           
					 
					 
		
评论