我的任务是制作为软件生成密钥的应用程序的在线版本(用于自动化目的)。
每个软件都会向用户显示一个访问代码(来自系统音量信息),并且该代码的密钥由一个小应用程序生成。所以客户提供例如访问代码:123,他取回密钥:321。
现在的问题是,为这个特定软件生成密钥的小应用程序的源代码丢失了,但我确实有验证功能
Public Function ValidateKey(AccessCode As Long, AccessKey As Long)
Dim lngNewKey As Double
Dim strHexKey As String
Dim btCode(1) As Byte
Dim lngCode As Long
If AccessKey = 0 Then
ValidateKey = False
Exit Function
End If
If AccessCode = 0 Then
ValidateKey = False
Exit Function
Else
lngNewKey = AccessKey
strHexKey = Hex(lngNewKey)
If Len(strHexKey) = 5 Then strHexKey = "0" & strHexKey
btCode(0) = CByte("&H" & Mid(strHexKey, 1, 2))
btCode(1) = CByte("&H" & Mid(strHexKey, 5, 2))
lngCode = CLng(btCode(0)) * 256 + CLng(btCode(1))
lngCode = lngCode * 15 + 5
ValidateKey = (lngCode = AccessCode)
End If
End Function
此函数在客户端软件中运行,并检查用户提供的密钥(AccessKey)与 AccessCode 相比是否正确。
因此,为了找到关键生成函数,我开始通过执行以下操作来反转它:
AccessCode = AccessCode - 5
AccessCode = AccessCode / 15
但后来我被卡住了,因为前面的操作看起来像一个哈希操作,似乎很难逆转。
我有以下数据(通过使用独立的密钥生成应用程序):
for accesscode 111440 the key should be 1946629
for accesscode 200000 the key should be 3453973
for accesscode 65536 the key should be 1160209
for accesscode 8192 they key should be 177186
for accesscode 4096 they key should be 111633
它使用的最小访问码是 3838。
我想知道是否可以推导出密钥生成函数。
先感谢您