Hack Forums
[.NET] [Just for Fun] Key Generator with a very simple Algorithm - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [Just for Fun] Key Generator with a very simple Algorithm (/showthread.php?tid=5779560)

Pages: Pages 1 2


[Just for Fun] Key Generator with a very simple Algorithm - Barret - Jan 4, 2018

Before i start, this is in no way secure, its merely a simple demo of a random generated key that has a super simple algorithm that can be verified on both ends.
It was just for fun, has no real purpose, i just felt like making this, sometimes you just do stuff with absolutely no reason at all.  🤫

It begins by generating a random number between 10 ~ 99 this is called the factor.
Next it starts to create the number blocks, these consist out of 1 real and 3 fake numbers, the first number is used as accumulator, 
it keeps looping and adding these blocks until the accumulator reaches the equal sum of the factor or beyond, if it is beyond the factor it makes a correction number.
The factor has to be a 2-digit number the correction number does not, however it will be padded by 0's to make a 4-digit number.

Example:

Key: [10|02]-3000-2000-1000-3000-2000 (assume the zero's are random generated)

Code
 [3]000
 [2]000
 [1]000
 [3]000
 [2]000
--------------
 [12]000 - correction(2) = factor(10)
Remark: This also means the key is never a fixed length

Few keys generated by the code:
Code
1502-8360-8836-1743 = (8 + 8 + 1) - 2 = 15
3305-7469-3906-8181-6321-4190-6322-4643 = (7 + 3 + 8 + 6 + 4 + 6 + 4) - 5 = 33


Source: https://gist.github.com/TheBarret/644cac300a8f6594d7ff4154366da41c

Perhaps useless to some, maybe useful for others, that i leave up to you.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Ninja - Jan 4, 2018

Why a function for the random instance when you instantiate it as static anyways inside the method? Why not declare it a scope higher and set it in the constructor?


RE: [Just for Fun] Key Generator with a very simple Algorithm - debug - Jan 5, 2018

Static rnd As New Random(Environment.TickCount)


ew


RE: [Just for Fun] Key Generator with a very simple Algorithm - Barret - Jan 5, 2018

(Jan 5, 2018 11:20 AM)debug Wrote:  Static rnd As New Random(Environment.TickCount)


ew

Aww he still butt hurt we kicked and banned his ass out. how cute ^^ you can eww all you want, i know im right and thats all there is to it.


RE: [Just for Fun] Key Generator with a very simple Algorithm - weld - Jan 5, 2018

Definitely a cool project. I dont really understand the hate :)


RE: [Just for Fun] Key Generator with a very simple Algorithm - Barret - Jan 5, 2018

(Jan 5, 2018 02:01 PM)weld Wrote:  Definitely a cool project. I dont really understand the hate :)

They are butt hurt coz i banned them both of my discord where all the cool programmer guys hang out ^^


RE: [Just for Fun] Key Generator with a very simple Algorithm - Ninja - Jan 5, 2018

(Jan 5, 2018 02:27 PM)Barret Wrote:  They are butt hurt coz i banned them both of my discord where all the cool programmer guys hang out ^^

How does being "butt hurt" invalidate my point? I really couldn't care less about being in the Discord.


RE: [Just for Fun] Key Generator with a very simple Algorithm - debug - Jan 6, 2018

(Jan 5, 2018 05:16 PM)Ninja Wrote:  How does being "butt hurt" invalidate my point? I really couldn't care less about being in the Discord.

^ I've got bigger and better things to do than join the dick sucking.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Sn0wX - Jan 7, 2018

I am completely shocked. From a member of said years experience, i'm dumfounded seeing a function return only returning One value regardless of anything.

I closed VS down within an instant seeing this.

Code
    Public Shared Function Validate(key As String) As Boolean
' what ever here
        Return False
    End Function

Have you suddenly forgot what a function is? a sub!!!! mate :/


RE: [Just for Fun] Key Generator with a very simple Algorithm - Ninja - Jan 7, 2018

(Jan 6, 2018 09:03 PM)debug Wrote:  ^ I've got bigger and better things to do than join the dick sucking.

Amen brother.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Hawk HF - Jan 7, 2018

(Jan 7, 2018 03:38 PM)Sn0wX Wrote:  I am completely shocked. From a member of said years experience, i'm dumfounded seeing a function return only returning One value regardless of anything.

I closed VS down within an instant seeing this.

Code
    Public Shared Function Validate(key As String) As Boolean
' what ever here
        Return False
    End Function

Have you suddenly forgot what a function is? a sub!!!! mate :/

You can't act like you haven't done this before... You have an idea for a method, but you're working on something else, so you just define it with the intent to come back to it later.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Ninja - Jan 7, 2018

(Jan 7, 2018 09:50 PM)Hawk HF Wrote:  You can't act like you haven't done this before... You have an idea for a method, but you're working on something else, so you just define it with the intent to come back to it later.

And that 'later' should be before releasing it.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Hawk HF - Jan 8, 2018

(Jan 7, 2018 10:03 PM)Ninja Wrote:  And that 'later' should be before releasing it.

Meh, it's a project labeled [Just For Fun].


RE: [Just for Fun] Key Generator with a very simple Algorithm - Ninja - Jan 8, 2018

(Jan 8, 2018 05:36 AM)Hawk HF Wrote:  Meh, it's a project labeled [Just For Fun].

Still, bad practices should be avoided. I can't sleep if I release code that I know contains flaws.


RE: [Just for Fun] Key Generator with a very simple Algorithm - Dialog - Jan 8, 2018

(Jan 8, 2018 09:04 AM)Ninja Wrote:  Still, bad practices should be avoided. I can't sleep if I release code that I know contains flaws.

4+ years without sleeping? That must be tough.