Created
April 1, 2023 21:33
-
-
Save wherrera10/acd7073d8bef48930279230e252f35b4 to your computer and use it in GitHub Desktop.
Julia code to make a Windows 95 key, created for an installation running in VirtualBox under a registered copy of Windows 10.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" from C code at https://github.com/stonesword0/win95-key-generator """ | |
usage() = println("\nUsage:\n\n-h, --help, -help - Displays the help\n-o, -oem - Generates a Windows 95 OEM Key\n-cd, -cdkey - Generates a Windows 95 CD Key") | |
function win95cdkey() | |
chunk1 = rand(100:998) | |
if chunk1 in [333, 444, 555, 666, 777, 888] | |
chunk1 = 635 | |
end | |
chunk2 = [0, 0, 0, 0, 0, 0, 1] | |
while sum(chunk2) % 7 != 0 | |
chunk2 .= rand(0:8, 7) | |
end | |
println("\nKey: $chunk1-", join(map(string, chunk2)), "\nThanks for using my program!\n") | |
end | |
function win95oem() | |
chunk1 = rand(001:366) | |
chunk2 = rand(195:203) % 100 | |
chunk4 = [0, 0, 0, 0, 0, 9] | |
chunk5 = rand(10000:19000) | |
while sum(chunk4) % 7 != 0 || chunk4[6] in [0, 9] | |
chunk4 .= rand(0:9, 6) | |
end | |
println("\nOEM Key: $chunk1$chunk2-OEM-0", join(map(string, chunk4)), "-", chunk5) | |
println("\nThanks for using my program!\n"); | |
end | |
function main() | |
if length(ARGS) != 1 | |
usage() | |
println("\nNeed exactly one argument after script name (-o or -cd, for example). Try again.\n") | |
else | |
arg = lowercase(ARGS[1]) | |
if arg in ["--help", "-help", "-h"] | |
usage() | |
elseif arg in ["-o", "-oem"] | |
win95oem() | |
elseif arg in ["-cd", "-cdkey"] | |
win95cdkey() | |
else | |
usage() | |
println("\nIncorrect argument supplied. Please try again.\n") | |
end | |
end | |
end | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment