Skip to main content

A strong password generator program with source code

In my previous post https://steemit.com/programming/@royalmacro/a-free-open-source-data-encryption-program-for-steemit-users I share a data encrypton tool with source code, now, today here I share another program, a strong password generator with source code.
This program will generate strong, hard-to-guess passwords. I’ll do it by hashing together “domain name”, “login/user id” & “a secure master key”.
If you use the same secure master key for every password generations then you do not need to write down or, memorize your generated passwords. When you need your password then repeat the same procedure to re-generate it. If your “domain name”, “login/user id” & “a secure master key” are not different then you will generate the same password.
If you use only one secure master key then you have to only memorize your master key, not the passwords.
Lets try it !
Step by Step Development :
Open a new project in Visual Basic 8. Select “Standard EXE”.


Create 5 text boxes & one command button. Text1 textbox, Text2 textbox, Text3 textbox, Text4 textbox, Text5 textbox & Command1 commandbutton.
enter image description here
Add 5 Labels with captions “domain name”, “login/user id”, “secure master key”, “strong password” & “normal password”. And change the caption of the Command1 commandbutton to “Generate”. Add the passwordchar “*” to the Text3 textbox “password char” properties.
enter image description here
Add a module “Module 1” to the project
enter image description here
Add this following codes to the module “Module 1” :
enter image description here
Option Explicit

Public Function CryptRC4(sText As String, sKey As String) As String
Dim baS(0 To 255) As Byte
Dim baK(0 To 255) As Byte
Dim bytSwap     As Byte
Dim lI          As Long
Dim lJ          As Long
Dim lIdx        As Long

For lIdx = 0 To 255
    baS(lIdx) = lIdx
    baK(lIdx) = Asc(Mid$(sKey, 1 + (lIdx Mod Len(sKey)), 1))
Next
For lI = 0 To 255
    lJ = (lJ + baS(lI) + baK(lI)) Mod 256
    bytSwap = baS(lI)
    baS(lI) = baS(lJ)
    baS(lJ) = bytSwap
Next
lI = 0
lJ = 0
For lIdx = 1 To Len(sText)
    lI = (lI + 1) Mod 256
    lJ = (lJ + baS(lI)) Mod 256
    bytSwap = baS(lI)
    baS(lI) = baS(lJ)
    baS(lJ) = bytSwap
    CryptRC4 = CryptRC4 & Chr$((pvCryptXor(baS((CLng(baS(lI)) + baS(lJ)) Mod 256), Asc(Mid$(sText, lIdx, 1)))))
Next
End Function

Public Function pvCryptXor(ByVal lI As Long, ByVal lJ As Long) As Long
If lI = lJ Then
    pvCryptXor = lJ
Else
    pvCryptXor = lI Xor lJ
End If
End Function

Public Function ToHexDump(sText As String) As String
Dim lIdx            As Long

For lIdx = 1 To Len(sText)
    ToHexDump = ToHexDump & Right$("0" & Hex(Asc(Mid(sText, lIdx, 1))), 2)
Next
End Function

Public Function FromHexDump(sText As String) As String
Dim lIdx            As Long

For lIdx = 1 To Len(sText) Step 2
    FromHexDump = FromHexDump & Chr$(CLng("&H" & Mid(sText, lIdx, 2)))
Next
End Function
Input this following code to Form1 :
enter image description here
Private Sub Command1_Click()
Dim KEY As String
Dim Password As String
Dim str1, str2, str3, str4, laststr As String

If Me.Text1.Text = "" Then
MsgBox "Error - You have entered no domain!", vbCritical, "Error"
ElseIf Me.Text2.Text = "" Then
MsgBox "Error - You have entered no Login ID!", vbCritical, "Error"
ElseIf Me.Text3.Text = "" Then
MsgBox "Error - You have entered no master key!", vbCritical, "Error"
ElseIf Len(Me.Text3.Text) < 3 Then
MsgBox "Error - You have entered too short Master Key. Please, enter at least 3 characters!", vbCritical, "Error"
Else

KEY = LCase(Me.Text1.Text) + LCase(Me.Text2.Text)

Password = ToHexDump(CryptRC4(Me.Text3.Text, KEY))
If Len(Password) > 18 Then
Password = Mid$(Password, 1, 18)
End If

str1 = Mid$(Password, 1, 1)
str2 = Mid$(Password, 2, 1)
str3 = Mid$(Password, 3, 1)
str4 = Mid$(Password, 4, 1)
laststr = Mid$(Password, 5, Len(Password) - 4)

If Len(Me.Text3.Text) = 3 Then

Me.Text4.Text = str1 + "S" + str2 + "^" + str3 + "7" + str4 + "l" + laststr
Me.Text5.Text = str1 + "t" + str2 + "3" + str3 + "I" + str4 + "0" + laststr

ElseIf Len(Me.Text3.Text) = 4 Then

Me.Text4.Text = str1 + "R" + str2 + "$" + str3 + "8" + str4 + "j" + laststr
Me.Text5.Text = str1 + "k" + str2 + "7" + str3 + "X" + str4 + "5" + laststr

ElseIf Len(Me.Text3.Text) = 5 Then

Me.Text4.Text = str1 + "E" + str2 + "%" + str3 + "6" + str4 + "g" + laststr
Me.Text5.Text = str1 + "d" + str2 + "2" + str3 + "U" + str4 + "4" + laststr

ElseIf Len(Me.Text3.Text) = 6 Then

Me.Text4.Text = str1 + "H" + str2 + "!" + str3 + "5" + str4 + "m" + laststr
Me.Text5.Text = str1 + "v" + str2 + "1" + str3 + "F" + str4 + "0" + laststr

ElseIf Len(Me.Text3.Text) = 7 Then

Me.Text4.Text = str1 + "J" + str2 + "~" + str3 + "6" + str4 + "c" + laststr
Me.Text5.Text = str1 + "w" + str2 + "7" + str3 + "Q" + str4 + "9" + laststr

ElseIf Len(Me.Text3.Text) = 8 Then

Me.Text4.Text = str1 + "Z" + str2 + "#" + str3 + "8" + str4 + "h" + laststr
Me.Text5.Text = str1 + "o" + str2 + "6" + str3 + "T" + str4 + "4" + laststr

ElseIf Len(Me.Text3.Text) = 9 Then

Me.Text4.Text = str1 + "Y" + str2 + "@" + str3 + "5" + str4 + "d" + laststr
Me.Text5.Text = str1 + "p" + str2 + "4" + str3 + "W" + str4 + "7" + laststr

ElseIf Len(Me.Text3.Text) = 10 Then

Me.Text4.Text = str1 + "Z" + str2 + "&" + str3 + "8" + str4 + "n" + laststr
Me.Text5.Text = str1 + "y" + str2 + "2" + str3 + "G" + str4 + "5" + laststr

ElseIf Len(Me.Text3.Text) = 11 Then

Me.Text4.Text = str1 + "B" + str2 + "*" + str3 + "3" + str4 + "j" + laststr
Me.Text5.Text = str1 + "f" + str2 + "0" + str3 + "V" + str4 + "7" + laststr

ElseIf Len(Me.Text3.Text) = 12 Then

Me.Text4.Text = str1 + "Q" + str2 + "(" + str3 + "6" + str4 + "e" + laststr
Me.Text5.Text = str1 + "r" + str2 + "5" + str3 + "W" + str4 + "9" + laststr

ElseIf Len(Me.Text3.Text) = 13 Then

Me.Text4.Text = str1 + "U" + str2 + ")" + str3 + "7" + str4 + "t" + laststr
Me.Text5.Text = str1 + "m" + str2 + "4" + str3 + "K" + str4 + "7" + laststr

ElseIf Len(Me.Text3.Text) = 14 Then

Me.Text4.Text = str1 + "O" + str2 + "-" + str3 + "2" + str4 + "l" + laststr
Me.Text5.Text = str1 + "w" + str2 + "6" + str3 + "I" + str4 + "4" + laststr

ElseIf Len(Me.Text3.Text) = 15 Then

Me.Text4.Text = str1 + "X" + str2 + "=" + str3 + "7" + str4 + "j" + laststr
Me.Text5.Text = str1 + "d" + str2 + "5" + str3 + "V" + str4 + "6" + laststr

ElseIf Len(Me.Text3.Text) = 16 Then

Me.Text4.Text = str1 + "C" + str2 + "+" + str3 + "6" + str4 + "n" + laststr
Me.Text5.Text = str1 + "m" + str2 + "9" + str3 + "J" + str4 + "8" + laststr

ElseIf Len(Me.Text3.Text) > 16 Then

Me.Text4.Text = str1 + "T" + str2 + "+" + str3 + "6" + str4 + "y" + laststr
Me.Text5.Text = str1 + "l" + str2 + "9" + str3 + "X" + str4 + "8" + laststr


End If
End If
End Sub
Make the exe file :
enter image description here
Completed ! Now run the exe file :
enter image description here
In this tutorial I use “gmail.com” as domain, “samplegmailaccount@gmail.com” as login/user id & “12345678” as my secure master key. And after pressing the “Generate” button I got two types of passwords – strong (0Z5#388h834926252CB6) & normal (0o563T84834926252CB6). Look strong type passwords has special characters & normal has not. Some websites don’t support any special characters as password. So, you can normal password there. If you change any fields of domain, login/user id & secure master key then this program will generate quite different password.
If you use only one secure master key to generate your passwords then you have to only memorize your master key, not the passwords. And you will generate different types of strong passwords for different websites or Login/User IDs.
Thank you :D

Tags : Open Source Project, Programming, Security, Software, Steemit, Visual Basic, 

This Post Was Published On My Steemit Blog. Please, navigate to steemit and cast a free upvote to help me if you like my post. First Time heard about Steemit ? Click Here To Know Everything About Steemit 



$3 Donation [Fixed]

$Any Amount





Comments

Popular Posts (Last 7 Days)

"royalmacro" trail short update - Auto Upvote List

Today I just included a few steemians in my auto upvote list -- All posts of the following accounts must be auto upvoted by the trail after 30 minutes of publishing @gyanibilli @gamerveda @arnob @indiantraveller @nadira @libert @mindfreak @sujoy1990 @chotto @jznsamuel @munmunbiswas  [Plz activate on trail] @leohira123 @ragini00 @simaroy @atkins @drsupriya18 @jimmyrai28  [Plz activate on trail] @ronald0 @jerremie @jsantana @blacks  [Plz activate on trail] @artists @steemmeets @firepower @pharesim @steampty @rahul.stan @looftee @richman @vaibhavshah @terrycraft @slowwalker @trafalgar @ericvancewalton @papa-pepper @gavvet @benjojo @crowdfundedwhale @curie @abdullar @jlufer  [Plz activate on trail] @mgibson @funnyman  [Plz activate on trail] @elyaque  [Plz activate on trail] However, some users are delisted now but, they must be listed in the near future if they enable their account on trail. I request now the following members to enab

Life without modern gadgets

We can't think about a day without electronic gadgets. The day starts with a computerized wake up timer and "advanced" goes with us for the duration of the day – wherever we go and whatever we do.  These electronic contraptions have officially left a tremendous effect on our way of life; individuals of any age are utilizing diverse sorts of devices. It is presently for all intents and purposes difficult to live without these things; figuring out how schedule to keeping up all contacts, every one of our exercises are controlled by contraptions and thingamabobs.  PDAs lie at the focal point of our life; updates, to-do's, contacts, messages – everything can be followed with a most recent mobile phone set. Music mates can purchase a cell telephone with great sound quality, radio and enough memory to store melodies. iPods are likewise very mainstream among music significant others nowadays.  iPhones and iPads are two most recent advancements that have g

One Black & White Photograph Daily for 30 days - Day #25

green yard - behind of my village home Camera : Xiaomi Model : 2014818 Location : Bongaon, West Bengal, India Snap Taken : 14 March 2016 Tags : Black & White Photography, Flowers & Plants photography, Landscape photography, Nature, Photography,  This Post Was Published On My Steemit Blog . Please, navigate to steemit and cast a free upvote to help me if you like my post. First Time heard about Steemit ? Click Here To Know Everything About Steemit  $3 Donation [Fixed] Donate $Any Amount

What I Learnt Today : 10 Unknown Amazing Facts About Animals - Part CXXXIII

  image credit (1) Japanese Macaques make snowballs for fun. (2) The chevrotain is an animal that looks like a tiny deer with fangs. (3) Turritopsis nutricula Immortal jellyfish is the only species known to live forever. (4) One million stray dogs and 500,000 stray cats live in New York City metropolitan area. Turritopsis nutricula Immortal jellyfish   image credit (5) Nine-banded armadillos always give birth to identical quadruplets. (6) The flying frog uses flaps of skin between its toes to glide. (7) It takes a sloth two weeks to digest its food.   Nine-banded armadillo   flying frogs   image credit (8) A narwhal tusk is actually an exaggerated front left tooth, and unlike most teeth, it's soft and sensitive on the outside with a tough interior. (9) Humpback whales create the loudest sound of any living creature. (10) The slowest mammal on earth is the tree sloth. It only moves at a speed of 6 feet (1.83 meters) per minute. sloth narwhal tusk   i

The Real Face Of India - Episode 133

The Real Face Of India - Episode#133 I believe that India is the most beautiful country in the world. In this series I show the real face of beautiful India. Half Dozen Photos of Natural Beauties Snap taken : 21 Mar 2018   Camera : SAMSUNG, Model : SM-A310N0 Other Episodes :  Episode#01 ,  Episode#02 ,  Episode#03 ,  Episode#04 ,  Episode#05 ,  Episode#06 ,  Episode#07 ,  Episode#08 ,  Episode#09 ,  Episode#10 ,  Episode#11 ,  Episode#12 ,  Episode#13 ,  Episode#14 ,  Episode#15 ,  Episode#16 ,  Episode#17 ,  Episode#18 ,  Episode#19 ,  Episode#20 ,  Episode#21 ,  Episode#22 ,  Episode#23 ,  Episode#24 ,  Episode#25 ,  Episode#26 ,  Episode#27 ,  Episode#28 ,  Episode#29 ,  Episode#30 ,  Episode#31 ,  Episode#32 ,  Episode#33 ,  Episode#34 ,  Episode#35 ,  Episode#36 ,  Episode#37 ,  Episode#38 ,  Episode#39 ,  Episode#40 ,  Episode#41 ,  Episode#42 ,  Episode#43 ,  Episode#44 ,  Episode#45 ,  Episode#46 ,  Episode#47 ,  Episode#48 ,  Episode#49 ,  Episode#50 , 

Before A Heavy Rainfall

I clicked at the exact time ; after about 5 minutes rain started Location : Dakshineswar, Kolkata Snap taken : 02 August 2016 Camera : Xiaomi ; model - 2014818 Tags : Photography, Nature, Landscape photography, Flowers & Plants photography, Sky,  This Post Was Published On My Steemit Blog . Please, navigate to steemit and cast a free upvote to help me if you like my post. First Time heard about Steemit ? Click Here To Know Everything About Steemit  $3 Donation [Fixed] Donate $Any Amount

The Real Face Of India - Episode 119

The Real Face Of India - Episode#119 I believe that India is the most beautiful country in the world. In this series I show the real face of beautiful India. Half Dozen Photos of Natural Beauties Snap taken : 22 Jan 2018   Camera : SONY, Model : DSC-W710 Other Episodes :  Episode#01 ,  Episode#02 ,  Episode#03 ,  Episode#04 ,  Episode#05 ,  Episode#06 ,  Episode#07 ,  Episode#08 ,  Episode#09 ,  Episode#10 ,  Episode#11 ,  Episode#12 ,  Episode#13 ,  Episode#14 ,  Episode#15 ,  Episode#16 ,  Episode#17 ,  Episode#18 ,  Episode#19 ,  Episode#20 ,  Episode#21 ,  Episode#22 ,  Episode#23 ,  Episode#24 ,  Episode#25 ,  Episode#26 ,  Episode#27 ,  Episode#28 ,  Episode#29 ,  Episode#30 ,  Episode#31 ,  Episode#32 ,  Episode#33 ,  Episode#34 ,  Episode#35 ,  Episode#36 ,  Episode#37 ,  Episode#38 ,  Episode#39 ,  Episode#40 ,  Episode#41 ,  Episode#42 ,  Episode#43 ,  Episode#44 ,  Episode#45 ,  Episode#46 ,  Episode#47 ,  Episode#48 ,  Episode#49 ,  Episode#50 ,  Epi

Ancient alligators which had long legs and run faster than dinosaurs, also ate them

image credit Imagine an alligator with long four legs and runs faster than dogs. Am I crazy ? Probably not. But, this species is now extinct. They lived in the Jurassic Period. The name this amazing creature is Galloping crocodile. It existed 100 million years ago. And also they preyed on dinosaurs!  The most attractive features of Galloping crocodiles are their bone structure. After made research on their bones structure scientists said that they were efficient swimmers but that when they clambered ashore they were also capable of galloping across the plains. But, modern crocodiles crawl on their bellies because their legs sprawl out to the side.  The fossils of this primitive crocodiles are now discovered in North Africa by a group of fossil hunters. Most of the fossils was discovered in the year of 2001.  Hans Larsson , a paleontologist at the University of Montreal, who took part in the expedition which was sponsored by National Geographic, wrote -  "We were surpr

Visiting deep inside the Sundarbans & spent days with Bawali - Episode #08

In the last October-November I visited Sundarbans, the world's one of the largest mangrove forest. It was also declared as world heritage site by UNESCO in 1997. In this forest a numerous wildlife species exist - birds, reptiles, fishes, amphibians and also the king of the forest "Royal Bengal Tiger". The ganges dolphins & crocodiles are also living in the canals of Sundarbans. Chital is a one kind of spotted deer living in this forest. The rural life in the area of this coastal forest is also very attractive. They basically maintain their lives by collecting honey, woods and fishes. In the native language they are called as Bawali. I spent some days with them. Here I share some of my tour photographs of Sundarbans and Bawali -- Deep Inside The Mangrove forest Sundarbans Camera : SONY Model : DSC-W710 Location : Sundarbans, West Bengal, India Snap Taken : 03 Nov 2017 To Be Continued... Episode : 01 , Episode : 02 , Episode : 03 , Episode : 04 , Episode

Amazing arts by unknown artists - Series #37

I captured all these art photographs in the Kolkata Book Fair, 2018. I tried to know the original artists of these awesome arts, but, failed. Enjoy this awesome arts. All credits goes to the unknown artists :) To Be Continued.. Previous Episodes :  Episode#01 ,  Episode#02 ,  Episode#03 ,  Episode#04 ,  Episode#05 ,  Episode#06 ,  Episode#07 ,  Episode#08 ,  Episode#09 ,  Episode#10 ,  Episode#11 ,  Episode#12 ,  Episode#13 ,  Episode#14 ,  Episode#15 ,  Episode#16 ,  Episode#17 ,  Episode#18 ,  Episode#19 ,  Episode#20 ,  Episode#21 ,  Episode#22 ,  Episode#23 ,  Episode#24 ,  Episode#25 ,  Episode#26 ,  Episode#27 ,  Episode#28 ,  Episode#29 ,  Episode#30 ,  Episode#31 ,  Episode#32 ,  Episode#33 ,  Episode#34 ,  Episode#35 ,  Episode#36 Tags : Art, Drawing, Fine arts, Painting, Photography,  This Post Was Published On My Steemit Blog . Please, navigate to steemit and cast a free upvote to help me if you like my post. First Time heard about Steemit ? Click Here To Kn
Back to Top