Phrase to Passphrase (Password) Generator

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
After having read http://www.codinghorror.com/blog/2005/08/passphrase-evangelism.html" target="_blank
this article, I wanted to make a simple program for people to create passwords out of phrases. A phrase can be a quote, or something that is easy for you to remember. An example would be: "I visit the MSDN often". The passphrase from that would be: "IvtMo".
Notice the case is retained. The phrase is just the first character of every word. The button click function is to convert the phrase into passphrase.
The capital() function is change random characters in the passphrase to uppercase. This works by using the <span style="white-space:pre Dim x As String = Int(TextBox2.Text.Length * Rnd())
<span style="white-space:pre which allows "x" to be equal to the length of the passphrase text times a random.
<span style="text-decoration:underline Controls :

Button named Button1 CheckBox named CheckBox1 TextBox named TextBox1 TextBox named TextBox2

<div style="color:black; background-color:white
<pre> <span style="color:blue Private <span style="color:blue Sub Button1_Click(sender <span style="color:blue As System.Object, e <span style="color:blue As System.EventArgs) <span style="color:blue Handles Button1.Click

<span style="color:blue If TextBox1.Text <> <span style="color:blue String.Empty <span style="color:blue Then

<span style="color:green Trims TextBox1.Text
TextBox1.Text = TextBox1.Text.Trim

<span style="color:green TextBox2 Text equals TextBox1 trim location 0,1
TextBox2.Text = TextBox1.Text.Substring(0, 1)

<span style="color:green Declares start = 1
<span style="color:blue Dim start <span style="color:blue As <span style="color:blue Integer = 1

start = TextBox1.Text.IndexOf(<span style="color:#a31515 " ", start)

<span style="color:blue While (start > 0)

TextBox2.Text += TextBox1.Text.Substring(start + 1, 1)

start = TextBox1.Text.IndexOf(<span style="color:#a31515 " ", start + 1)

<span style="color:blue End <span style="color:blue While

<span style="color:blue If CheckBox1.Checked = <span style="color:blue True <span style="color:blue Then
capital()
<span style="color:blue End <span style="color:blue If

<span style="color:blue End <span style="color:blue If

<span style="color:blue End <span style="color:blue Sub

<span style="color:blue Private <span style="color:blue Sub capital()

<span style="color:green Description: Randomly replace substring characters with the uppercase equivalent.
<span style="color:green Programmer: Jordan St. Godard
<span style="color:green Website: http://metasdevelopment.com/
<span style="color:green MSDN: http://social.msdn.microsoft.com/profile/jordan%20st.%20godard/?type=forum

<span style="color:green Declare oldText
<span style="color:blue Dim oldText <span style="color:blue As <span style="color:blue String

<span style="color:green Declare newText
<span style="color:blue Dim newText <span style="color:blue As <span style="color:blue String

<span style="color:green Declare subStr
<span style="color:blue Dim subStr <span style="color:blue As <span style="color:blue String

<span style="color:green Declare x
<span style="color:blue Dim x <span style="color:blue As <span style="color:blue String = Int(TextBox2.Text.Length * Rnd())

<span style="color:green Gets the current text and gets ready to use the random x for start position
oldText = TextBox2.Text.Substring(x, 1)

<span style="color:green Converts the string to uppercase starting at point x
subStr = oldText.ToUpper()

<span style="color:green Replaces oldText with subStr and sets it equal to newText
newText = TextBox2.Text.Replace(oldText, subStr)

<span style="color:green Sets TextBox2.Text equal to newText
TextBox2.Text = newText

Exit_Proc:
<span style="color:blue Exit <span style="color:blue Sub

<span style="color:blue End <span style="color:blue Sub
[/code]


<br/>
The button click event source can be found http://www.freevbcode.com/ShowCode.asp?ID=831" target="_blank
here . I wrote the capital() function to make it more secure.
Also, the copyrights in the capital() function are <span style="text-decoration:underline
not required. Im posting this as open-source so feel free to modify as needed.
Hope this helps,
- Jordan
<
<span style="color:green If you find an answer helpful, click the Helpful button. If you find an answer to your question, mark it as the answer.<br/>
metasdevelopment.com www.metasdevelopment.com
Helpful Links:<br/>



<span style="font-style:normal http://msdn.microsoft.com/en-us/library/aa188202(office.10).aspx Visual Basic for Applications (VBA) Information
<span style="font-style:normal http://social.msdn.microsoft.com/Forums/en-US/isvvba/threads Visual Basic for Applications (VBA) MSDN Forum
<span style="font-style:normal http://www.developerfusion.com/tools/convert/csharp-to-vb/ Convert C# to VB.Net

<br/>
http://www.metasdevelopment.com" target="_blank <img src="http://metasdevelopment.files.wordpress.com/2011/08/mcc11_logo_horizontal_full-color.jpg" alt="
<br/>

View the full article
 

Similar threads

Back
Top