# Video TutorialHow to make a KeyGen - Ziggy's KeyGenMe Tutorial

#### ismaelvazquezjr

Meme Tier VIP
Fleep Tier Donator
Trump Tier Donator
Learn how to reverse engineer a key generation algorithm in Ziggy's KeyGenMe #0. A KeyGenMe is a program that is intentionally made for learning reverse engineering legally. We are not doing anything illegal in this video. KeyGenMes and CrackMes are common learning tools for ethical hackers. Even antivirus companies create CrackMes for ethical reasons.

Ziggy's KeyGenMe #0 is a very simple one that utilizes a simple XOR algorithm, which is very common. You will learn how to reverse engineer it using Ida Pro and then using this information we will show you a simple python script that can generate serials based on the username.

Python Key Generation Script
Python:
``````#!/usr/bin/env python3

encryption_buffer = 0x4E6AF4BC

full_serial = "FIT-"

print("[-] Username must be 5 characters long... Try again.")

i = 0
xor_val = ''.join([str(hex(ord(c))[2:]) for c in username[i:i+4]][::-1])
encryption_buffer ^= int(xor_val, 16)

i += 1
xor_val = ''.join([str(hex(ord(c))[2:]) for c in username[i:i+4]][::-1])
encryption_buffer ^= int(xor_val, 16)

full_serial += str(encryption_buffer)

print(f"The serial is: {full_serial}")``````

Last edited by a moderator:

#### KF1337

##### *copies code from tutorials, then breaks it.*
Dank Tier Donator
Full Member
Nobleman
First of all: love your reverse engineering videos! It can be a pain to start reversing, your videos are kinda kickstarting it.
It is very helpful that you comment every instruction that you analyze.

Is there a specific reason to use Dependency Walker, when you load it into IDA anyways and are able to look at the imports?

#### Rake

Is there a specific reason to use Dependency Walker, when you load it into IDA anyways and are able to look at the imports?
No, this is just an old school method of doing things that is taught in older books and tutorials

KF1337

#### ismaelvazquezjr

Meme Tier VIP
Fleep Tier Donator
Trump Tier Donator
Ziggy KeyGenMe #1 Tutorial with Python Script

#### Attachments

• 77 KB Views: 19
Langour

#### Langour

Full Member
Gr8 video, keep it up!.
I couldn't find anywhere Ziggy's KeyGenMe#0 executable file to download. Would be someone kind and share it?
I'll leave source code written in c++ for these KeyGens if someone would be interested in.

Edited:
C++:
``````#include <iostream>
#include <string>
#include <sstream>

int main()
{
std::string name;
std::getline(std::cin, name);

const size_t len = name.length();
if (len >= 5)
{
__int64 serial = 0x4E6AF4BC;
for (int i = 0; i < len - 3; ++i)
{
std::stringstream ss;
for (int j = 3; j >= 0; --j)
ss << std::hex << (int)name[j + i];

__int64 xorValue = 0;
ss >> xorValue;

serial ^= xorValue;
}
printf("Name: %s\nSerial: FIT-%I64d\n", name.c_str(), serial);
}
}``````

C++:
``````#include <iostream>
#include <string>

int main()
{
std::string name;
std::getline(std::cin, name);

int serial = 0;
for (const auto& ch : name)
{
if (ch != 32) // (space)
serial += toupper(ch) * 5961 - 1;
}
printf("Name: %s\nSerial: SnD-%i", name.c_str(), serial);
}``````

Last edited:

#### Rake

@Langour you can find it on tuts4you

Langour

#### diabloSOD

##### Learner
Trump Tier Donator
I just went on tuts4you to download it and it says the attachment is no longer available.

I tried downloading the mega-pack which includes Ziggys KeyGenMe #0 (Tuts 4 You KeygenMe Collection (2016)) and Windows Defender wouldn't let me download the file because it was flagged with "Trojan:Win32/Bumat!rts". It may be a false positive but I'm not too familiar with that field.

Does anybody here on the forum have that file specifically (Ziggys KeyGenMe #0)?

#### Rake

@diabloSOD that file is clean, it's a false positive

diabloSOD
Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language