下面的函数通过使用新的字符来替换原始的每一个字符而对值进行了加密。它先将每个字符转换为其对应的ASCII值,再使用一个偏量,然后将(加入偏量的)ASCII值转换回字符。这个偏量可以是从1到255之间的任何数。
PublicFunctionEncryptDecrypt(ByValValueAsString)AsString
DimstrCharAsString
DimintCountAsInteger
DimintASCIIAsInteger
DimstrEncryptedAsString
DimintOffsetAsInteger
intOffset=200
strEncrypted=vbNullString
ForintCount=1ToLen(Value)
strChar=Mid$(Value,intCount,1)
intASCII=Asc(strChar)XorintOffset
strEncrypted=strEncrypted&Chr(intASCII)
NextintCount
Enc...[ 查看全文 ]