j00n
April 18th, 2009, 20:06
Code:
Private Shared Function bValidSerial(ByVal sSerialToValidate As String) As Boolean
Dim num As Integer = 0
If (sSerialToValidate.Length <> &H1D) Then
Return False
End If
Dim str As String = sSerialToValidate.Substring(8, 1)
Dim str2 As String = sSerialToValidate.Substring(12, 1)
Dim str3 As String = sSerialToValidate.Substring(&H10, 1)
Dim str4 As String = sSerialToValidate.Substring(&H11, 1)
Dim str5 As String = sSerialToValidate.Substring(&H12, 1)
If ("1385".IndexOf(str) > -1) Then
num += 1
End If
If ("3892".IndexOf(str2) > -1) Then
num += 1
End If
If ("8629".IndexOf(str3) > -1) Then
num += 1
End If
If ("8629".IndexOf(str4) > -1) Then
num += 1
End If
If ("8629".IndexOf(str5) > -1) Then
num += 1
End If
sSerialToValidate = sSerialToValidate.Remove(0, 5)
sSerialToValidate = sSerialToValidate.Remove(3, 1)
sSerialToValidate = sSerialToValidate.Remove(6, 1)
sSerialToValidate = sSerialToValidate.Remove(12, 1)
sSerialToValidate = sSerialToValidate.Remove(11, 1)
sSerialToValidate = sSerialToValidate.Remove(10, 1)
sSerialToValidate = sSerialToValidate.Remove(9, 1)
sSerialToValidate = sSerialToValidate.Replace("-", ""
sSerialToValidate = sSerialToValidate.Replace(sSerialToValidate.Substring((sSerialToValidate.Length - 4), 4), ""
Dim num2 As Integer = 0
Dim i As Integer
For i = 0 To sSerialToValidate.Length - 1
num2 = (num2 + Convert.ToInt16(sSerialToValidate.Substring(i, 1)))
Next i
Return ((num = 5) AndAlso ((num2 Mod 7) = 0))
End Function
Code:
Private Shared Function bIsActivated(ByVal sActivationCodeToVerify As String) As Boolean
If (sActivationCodeToVerify.Length <> 8) Then
Return False
End If
Dim provider As New MD5CryptoServiceProvider
Dim bytes As Byte() = Encoding.ASCII.GetBytes((ProgramName.sSerial.Substring(0, 4) & DateTime.Parse(ProgramName.sInstallDate).Year))
bytes = provider.ComputeHash(bytes)
Dim str As String = ""
Dim i As Integer
For i = 0 To bytes.Length - 1
str = (str & bytes(i).ToString("x2".ToUpper)
Next i
Return (sActivationCodeToVerify = str.Substring(0, 8))
End Function
I unpacked a .net application and found these functions but I am stuck here... I'm actually surprised that I got this far... any help with the next steps would be appreciated...