Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function CreerID() As String
- 'on commence par ouvrir les clés
- Dim cléPID As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion", False)
- Dim cléGUID As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Cryptography", False)
- 'On enlève les tirets, pour avoir un seul code composé de chiffres/lettres uniquement
- Dim IDProduit As String = Replace(cléPID.GetValue("ProductId"), "-", "")
- Dim GUID As String = Replace(cléGUID.GetValue("MachineGUID"), "-", "")
- Dim tampon As String = ""
- 'on renverse les chaines..Juste pour rendre notre système de clé unique
- Dim strPID As String = StrReverse(IDProduit)
- Dim strGUID As String = StrReverse(GUID)
- 'On va mixer le tout pour obtenir un code constant et vraiment introuvable
- For i = 1 To IDProduit.Length 'pour chaque caractère du code
- tampon = tampon & Hex((Asc(Mid(strPID, i, 2)) Xor 15) Xor 100) 'on le convertit en quelque chose d'aléatoire
- Next i
- 'tampon est donc maintenant notre partie "IDProduit" finale
- 'On fait pareil pour le GUID
- For x = 1 To GUID.Length
- tampon = tampon & Hex((Asc(Mid(strGUID, x, 2)) Xor 12) Xor 100)
- Next x
- Dim IDHardware As String = tampon 'le code final qui rejoint les deux parties
- Return IDHardware
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement