Skip to content

Instantly share code, notes, and snippets.

@praswicaksono
Created November 24, 2014 04:25
Show Gist options
  • Save praswicaksono/07c2bb3fd15660a8028a to your computer and use it in GitHub Desktop.
Save praswicaksono/07c2bb3fd15660a8028a to your computer and use it in GitHub Desktop.
HiDownload Keygen
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim count As Integer = rand.Next(4, 9)
Dim part1 As String = genRamdomString(count)
TextBox1.Text = count.ToString() & part1 & doMD5(part1)
End Sub
Private Function genRamdomString(ByVal lenght As Integer)
Dim validchars As String = "1234567890"
Dim sb As New StringBuilder()
For i As Integer = 1 To lenght Step 1
sb.Append(validchars(rand.Next(0, validchars.Length)))
Next
Return sb.ToString()
End Function
Private Function doMD5(ByVal input As String)
Dim md5 As MD5 = System.Security.Cryptography.MD5.Create()
Dim inputBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(input & "HiDownloadPlatinum")
Dim hash As Byte() = md5.ComputeHash(inputBytes)
Dim sb As New StringBuilder()
For i As Integer = 0 To hash.Length - 1
sb.Append(hash(i).ToString("x2"))
Next
Return sb.ToString()
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment