InstallShield中的加密方法

本文介绍了一种在InstallShield中实现字符串加密和解密的简单方法。通过将字符串中的每个字符加17来加密,并在解密时减17。文章详细展示了加密和解密的函数代码,并解释了其中涉及的字符串操作。

在InstallShield中难免会对一些东东做加密操作,下面的方法就是一个简单的加密解密方法。这个方法对字符串中的每个字符加17,解密时同样减17:

加密:

function STRING String2Password (szName)
    STRING szRight, szLeft, szAnswer, dummy;
    CHAR   cChar;
    NUMBER nLength; 
begin         
    dummy = "JOQWE";
    szAnswer = "";
    nLength = StrLength(szName);
    while (nLength > 0)
        StrSub(szRight, szName, 1, (nLength-1));
        StrSub(szLeft, szName, 0, 1);
        cChar = STRTOCHAR(szLeft);
        cChar = cChar + 17;
        szName = szRight;
        CharReplace(szLeft,STRTOCHAR(szLeft),cChar,0);
        szAnswer = szAnswer + szLeft;
        nLength = nLength - 1;
     endwhile;     
     szAnswer = szAnswer + dummy;
     return szAnswer;
end;

解密:

function STRING Password2String (szPassword)
    NUMBER nLength, iCount;
    STRING szLeft, szRight, szAnswer;
    CHAR cChar;
begin                    
    szAnswer = "";
    nLength = StrLength(szPassword);
    for iCount = 1 to 4 
         StrSub(szRight, szPassword, 1, (nLength-1));
         StrSub(szLeft, szPassword, 0, 1);
         cChar = STRTOCHAR(szLeft);
         cChar = cChar - 17;
         szPassword = szRight;
         CharReplace(szLeft,STRTOCHAR(szLeft),cChar,0);
         szAnswer = szAnswer + szLeft;
         nLength = nLength - 1;
    endfor;
    return szAnswer;    
end;

其中有一些方法我想拿出来单独讲一下:

计算字符串的长度:

StrLength(szName);

截取字符串:

StrSub(szLeft, szName, 0, 1);

第一个参数是输出参数,第二个是要操作的字符串,第三个是开始截取的位置,最后一个是截取结束的位置。

将字符串转化为字符:

STRTOCHAR(szLeft);

这个方法返回一个字符变量。

InstallShield PackageForTheWeb Password Cracker (C)thewd@hotmail.com ------------------------------------------------------------------------------ Usage: ISpftw [/longPassword] [/ignoreLength] [/dumpHeaders] target installation that has been distributed using PackageForTheWeb [/longPassword] (PFTW v2.03+) used to attempt recovery of long passwords (28-54 characters) (requires a certain knowledge about the files contained within the cabinet) e.g. cabinet contains test.txt, test1.txt, test2.txt and test3.txt files a) Number Of Files : 4 b) Filenames Length : 45 c) Size Of First File : 4 d) Number Of Chunks : 1 e) Is Compressed? : Yes Notes ===== a) the number of files within the cabinet b) the total length of all the filenames (including directories), i.e. \test.txt \1\test1.txt \2\test2.txt \3\test3.txt = 9 + 12 + 12 + 12 = 45 c) the uncompressed size of the first file in the cabinet (in bytes) d) the number of data chunks used (depends on the size of the files) i.e. once a certain number of bytes have been compressed a new data chuck is created, but this value isn't fixed (depends on source) e) whether the cabinet data has been compressed (usually yes) Even if you don't know all the required information, by looking at the password recovered you may be able to guess the incorrect characters [/ignoreLength] (PFTW v2.03+) ignores the password length determined by this utility, because certain character combinations in the password can return the wrong value [/dumpHeaders] (PFTW v2.03+) dumps the encrypted and decrypted packagefortheweb file headers. Can be used to analyse the length and validity of the password and to determine which characters are invalid ------------------------------------------------------------------------------ Note: Supports InstallShield P
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值