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
-
VB6, SQL 2005 & DMO
by elajaunie3 (1 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
Automating Excel from VB6.0
by epurdy (0 replies)
-
VB6 system conversion using VBA to Word 2007
by b.macgregor@vodamail.co.za (0 replies)
-
video not working with visual basic
by Jupiter 2 (9 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.