这对我很有帮助很多年了。 谢谢MP,我想在用INI文件陪伴应用程序的行中,其中包含授权Autocad用户的加密序列号。主应用程序读取它调用的 Autocad 对象的序列号,并将其与加密的序列号进行核对。我在互联网上找到了一个免费的河豚en-/decryption dll,我可以使用:blofsh10.dll
'This gets the current Autocad serial number
Dim Serialnumber As String
Serialnumber = ThisDrawing.GetVariable("_PKSER")
为了防止人们用规避检查的dll替换dll,INI文件可以包含一个控制字符串,该字符串必须使用主应用程序中的硬编码密码(解密密钥)正确解密。
我赞成!
我在这里放了一个制作dll的vb项目示例:
http://www . website toolbox . com/tool/post/mill lister/vpost?id=1071084
将您的代码放在那里,阅读说明,然后就完成了。
如有任何问题,请随时打电话给我。
戴夫 我不介意对密钥/密码字符串使用简单的XOR加密。但是,如何将生成的字符串保持在0-9,A-Z,a-z等范围内,并能够准确地对其进行解密?
一个示例代码片段会很好!
简单且快速完成-
Function Encrypt(ByVal text As String, _
ByVal mask As String) _
As String
Dim i As Long, _
j As Long
Dim textBytes() As Byte, _
maskBytes() As Byte
Dim lbMask As Long, _
ubMask As Long
Dim xorCode As Integer
textBytes = text
maskBytes = mask
lbMask = LBound(maskBytes)
ubMask = UBound(maskBytes)
j = LBound(maskBytes)
For i = LBound(textBytes) To UBound(textBytes) Step 2
xorCode = textBytes(i) Xor maskBytes(j)
''modify this to suit
If3234 Then textBytes(i) = xorCode
j = j + 2: If ubMask < j Then j = lbMask
Next i
Encrypt = textBytes
End Function
在VB的即时窗口中测试-
?encrypt(" http://www . the swamp . org "," 123456")
YFGD://EDC。BYW@CT[A.\FR
?加密(" YFGD://EDC。BYW@CT[A.\FR "," 123456 ")
http://www . the swamp . org
页:
1
[2]