Guest User

Untitled

a guest
Jan 12th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Function GetKey() As String
  2. Dim RegKey As Microsoft.Win32.RegistryKey = _
  3. Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion", False)
  4. Dim bytDPID() As Byte = RegKey.GetValue("DigitalProductID")
  5. Dim bytKey(14) As Byte
  6. Array.Copy(bytDPID, 52, bytKey, 0, 15)
  7. Dim strChar As String = "BCDFGHJKMPQRTVWXY2346789"
  8. Dim strKey As String = ""
  9. For j As Integer = 0 To 24
  10. Dim nCur As Short = 0
  11. For i As Integer = 14 To 0 Step -1
  12. nCur = CShort(nCur * 256 Xor bytKey(i))
  13. bytKey(i) = CByte(Int(nCur / 24))
  14. nCur = CShort(nCur Mod 24)
  15. Next
  16. strKey = strChar.Substring(nCur, 1) & strKey
  17. Next
  18. For i As Integer = 4 To 1 Step -1
  19. strKey = strKey.Insert(i * 5, "-")
  20. Next
  21. Return strKey
  22. End Function
Add Comment
Please, Sign In to add comment