Library code snippets
Simple Encryption
By DT, published on 14 Jul 2001
Simple Encryption
Make four text boxes, and two controls. Name the text boxes txtCTC, txtCipher, txtCTDC, and txtDCC. Name the command buttons cmdCipher, and cmdDecipher. Input this code. When you enter a single letter in txtCTC and press cmdCipher, it comes out as a ciphered letter. When you put the ciphered letter in txtCTDC, it comes out as the original letter. This only works with one letter at a time.
Dim Num1 As String
Dim Num2 As String
Private Sub cmdCipher_Click()
Num1 = Asc(txtCTC.Text) 'Converts the letter to a ANSI number
Num1 = Num1 + 3 'Adds three to the ANSI number
Num2 = Chr$(Num1)
'Converts the ANSI number back to a letter
txtCipher.Text = txtCipher.Text + Num2 'Adds the ciphered letter to the end of whatever was previously in the textbox
End Sub
Private Sub cmdDecipher_Click()
Num1 = Asc(txtCTDC.Text) 'Converts the ciphered letter to a ANSI number
Num1 = Num1 - 3 'Subtracts three from the ANSI number
Num2 = Chr$(Num1) 'Converts the ANSI number back to a letter
txtDCC.Text = txtDCC.Text + Num2 'Adds the deciphered letter to the end of whatever was previously in the textbox
End Sub
'Credit goes to Daniel Thompson, A.K.A. HLF926
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
I made an encrypter once, named SafeCrypt, it's on my website, click here to download
i'll post the source for the encryption when i find the time and don't forget it.
Now does anyone have any suggestions on how to make this encription method a litle more complex..??
This thread is for discussions of Simple Encryption.