Ciao a tutti, in questi giorni stavo cercando qualcosa per fare decrypt e encrypt per creare delle license.
Ho trovato questo :
Public Const key As String = "414c657353614e44724f614d6532334e6f76524d42526531393736"
Public Function LicenseId(ByVal key As String) As String
Dim str As String
Try
Dim str2 As String = encrypt(String.Format("{1}{0}{2}{0}{3}", New Object() {"||", email, appName, appVer}), key)
str = encrypt(String.Format("{1}{0}{2}", "||", encrypt(str2, deviceId), deviceId), key)
Catch exception1 As Exception
Dim ex As Exception = exception1
str = Nothing
End Try
Return str
End Function
Public Shared Function decrypt(ByVal value As Byte(), ByVal key As String) As Byte()
Dim buffer As Byte() = StringToBytes(key)
Dim buffer3 As Byte() = Array.CreateInstance(GetType(Byte), value.Length)
Dim num3 As Integer = (value.Length - 1)
Dim i As Integer = 0
Do While (i <= num3)
Dim num As Integer = (value(i) - buffer((i Mod buffer.Length)))
buffer3(i) = Conversions.ToByte(Interaction.IIf((num < 0), (num + &HFF), num))
i += 1
Loop
Return buffer3
End Function
Public Shared Function encrypt(ByVal value As Byte(), ByVal key As String) As Byte()
Dim buffer As Byte() = StringToBytes(key)
Dim buffer3 As Byte() = Array.CreateInstance(GetType(Byte), value.Length)
Dim num3 As Integer = (value.Length - 1)
Dim i As Integer = 0
Do While (i <= num3)
Dim num As Integer = (value(i) + buffer((i Mod buffer.Length)))
buffer3(i) = Conversions.ToByte(Interaction.IIf((num > &HFF), (num Mod &HFF), num))
i += 1
Loop
Return buffer3
End Function
Public Shared Function StringToBytes(ByVal s As String) As Byte()
Dim buffer As Byte() = Array.CreateInstance(GetType(Byte), s.get_Length)
Dim length As Integer = buffer.Length
Dim i As Integer = 1
Do While (i <= length)
buffer((i - 1)) = Strings.Asc(Strings.Mid(s, i, 1))
i += 1
Loop
Return buffer
End Function
ma non capisco :
1.Come funziona
2. Ho provato ad lanciarlo e mi dice ;
Value of type 'String' cannot be converted to '1-dimensional
su questa riga :
encrypt(String.Format("{1}{0}{2}{0}{3}", New Object() {"||"
3. E questo errore che nn capisco perchè:
Error3'get_Length' is not a member of 'String'.
Grazie per tutti gli aiuti che mi darete.
Ciao a tutti.