Skip to content

Instantly share code, notes, and snippets.

@rjindael
Last active June 4, 2020 19:13
Show Gist options
  • Save rjindael/0954a2935b169973adea5d054037b013 to your computer and use it in GitHub Desktop.
Save rjindael/0954a2935b169973adea5d054037b013 to your computer and use it in GitHub Desktop.
Generates Windows 95 OEM and CD keys. Based off of https://www.youtube.com/watch?v=3DCEeASKNDk
import random
years = ["95", "96", "97", "98", "99", "00", "01", "02", "03"]
def divisible_random(min, max, divisor):
result = random.randint(min, max)
while result % divisor != 0:
result = random.randint(min, max)
return result
def oemkey():
date = str(random.randint(0, 366)).zfill(3)
year = random.choice(years)
time = date + year + "-OEM-"
whitespace = str(0)
randomkey = str(divisible_random(0, 999999, 7)).zfill(6)
key = whitespace + randomkey + "-"
junk = str(random.randint(0, 99999)).zfill(5)
return time + key + junk
def cdkey():
key = str(divisible_random(0, 999999999, 7)).zfill(9)
return key[:3] + "-" + key[3:]
print("Your OEM Key: " + oemkey() + "\nYour CD Key: " + cdkey())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment