Advertisement
Guest User

Untitled

a guest
Dec 29th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set WshShell = CreateObject("WScript.Shell")
  2. MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
  3. Function ConvertToKey(Key)
  4. Const KeyOffset = 52
  5. i = 28
  6. Chars = "BCDFGHJKMPQRTVWXY2346789"
  7. Do
  8. Cur = 0
  9. x = 14
  10. Do
  11. Cur = Cur * 256
  12. Cur = Key(x + KeyOffset) + Cur
  13. Key(x + KeyOffset) = (Cur \ 24) And 255
  14. Cur = Cur Mod 24
  15. x = x -1
  16. Loop While x >= 0
  17. i = i -1
  18. KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
  19. If (((29 - i) Mod 6) = 0) And (i -1) Then
  20. i = i -1
  21. KeyOutput = "-" & KeyOutput
  22. End If
  23. Loop While i >= 0
  24. ConvertToKey = KeyOutput
  25. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement