954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Encrypt and Decrypt

By Jery Ichigo Manuhutu on Feb 8th, 2008 9:24 am

This is code for Encrypt and Decrypt. this a simple logic of encryption. Please leave comment or feedback if this code helps you. Thanks. Jery. :)
the encrypt function place in a module.
This Code needed :
1 Module
1 combo box (For input before encryption) text1 in this program
2 label (For encryption result and encryption reading) --> label1 and label 3 in this program

'in a Module
' Encryption Methode by Jery M
Function Enkripsi(word As String) As String
Dim temp, temp2 As Integer
Dim temp3, temp4, temp5 As String
' file enkription
If Len(word > 0) Then
    ReDim CharacterValue(Len(word) - 1) As Byte
    For i = 0 To (Len(word) - 1)
    temp = Asc(Mid(word, i + 1, 1)) + 77
    If (temp > 255) Then temp = temp - 255
    CharacterValue(i) = CByte(temp)
    Next i
 
End If
End Function


'In a Form
' Encryption Methode by Jery M
Private Sub Form_Load()

End Sub

Private Sub Label1_Change()
Dim CriptVariable As Integer
Dim StringBuffer As String

If Len(Label1.Caption) > 0 Then
    'change data from label1 back to ke label3
    ReDim CharacterValue(Len(Label1.Caption) - 1) As Byte
    For i = 0 To (Len(Label1.Caption) - 1)
    CriptVariable = Asc(Mid(Label1.Caption, i + 1, 1)) - 77
    If CriptVariable < 0 Then CriptVariable = CriptVariable + 255
    CharacterValue(i) = CByte(CriptVariable)
    Next i
    'show it in label3
    StringBuffer = vbNullString
    For i = 0 To (Len(Label1.Caption) - 1)
    StringBuffer = StringBuffer & Chr(CharacterValue(i))
    Next i
    Label3.Caption = StringBuffer

Else
    MsgBox "empty"
End If
End Sub


Private Sub Text1_Change()
Dim CriptVariable As Integer
Dim StringBuffer As String
'Ambil data yang akan dan dienkripsi

If Len(Text1.Text) > 0 Then
    ReDim CharacterValue(Len(Text1.Text) - 1) As Byte
    For i = 0 To (Len(Text1.Text) - 1)
    CriptVariable = Asc(Mid(Text1.Text, i + 1, 1)) + 77
    If (CriptVariable > 255) Then CriptVariable = CriptVariable - 255
    CharacterValue(i) = CByte(CriptVariable)
    Next i
    'show encryption in label1
    StringBuffer = vbNullString
    For i = 0 To (Len(Text1.Text) - 1)
    StringBuffer = StringBuffer & Chr(CharacterValue(i))
    Next i
    Label1.Caption = StringBuffer
   Else
    Label1.Caption = vbNullString
End If
End Sub

wonderful code

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

lease send me another codes for [email]mansoor480@gmail.com[/email]

mansoor480
Newbie Poster
2 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

please send me another codes for Email Address:mansoor480@gmail.com

mansoor480
Newbie Poster
2 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

>> please send me another codes for Email Address:mansoor480@gmail.com

i m sorry mansoor but you must browsing this forum to get many codes here. we supplied it for free so used it with a wise.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Hi,I wont to learn how i create vb program. please tell me about it. I am a student. please tell me all about it.

saman sanjeewa
Newbie Poster
2 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,I wont to learn how i create vb program. please tell me about it. I am a student. please tell me all about it.

saman sanjeewa
Newbie Poster
2 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

post your question in vb section. you can learn anything there. fell free to asked from others.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

can you help me to give several examples of inscription program especially text inscription using RC4 and WAKE's methods.
Thank you so much for your help.
Best Regards,
Meta

imey
Newbie Poster
1 post since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

hi good day...thanks for your code!!!...as for now I'm looking forward to your new post.I want to ask if do you have a source code for encryption and decryption of password in database?preferably in MS ACCESS.Rignt now I'm studying your codes if I can Integrate it with my Project.......Thanks and God Bless!!!!

seo_vbnewbie
Newbie Poster
1 post since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

Am doing a project based on ATM machine..
and i encounter a problem that inserting a card??
For that i choose to insert a floppy or cd as the password and through that the user can login to the program..
can anyone send me the codes or idea for that ??
Is this possible in VB 6

karlosekevin
Newbie Poster
2 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Hi can i have code related to graphics and animations in vb 6.0 ....on address:asiyakainat@aol.com

Asiya Kainat
Newbie Poster
1 post since Oct 2009
Reputation Points: 8
Solved Threads: 0
 

Pls send me a code of making a wallpaper pls send the code in this email address [email]martmarjun20@yahoo.com[/email] tnx ^_^

martmarjun
Newbie Poster
2 posts since Oct 2009
Reputation Points: 8
Solved Threads: 0
 

pls send me a code how to make a wallpaper send in this email address pls [email]martmarjun20@yahoo.com[/email]

martmarjun
Newbie Poster
2 posts since Oct 2009
Reputation Points: 8
Solved Threads: 0
 

please send me the visual basic(6.0) source code for the encryption and decryption of data using Ceaser Cipher

wemd22
Newbie Poster
1 post since Oct 2009
Reputation Points: 8
Solved Threads: 0
 

'in a Module' Encryption Methode by Jery MFunction Enkripsi(word As String) As StringDim temp, temp2 As IntegerDim temp3, temp4, temp5 As String' file enkriptionIf Len(word > 0) Then ReDim CharacterValue(Len(word) - 1) As Byte For i = 0 To (Len(word) - 1) temp = Asc(Mid(word, i + 1, 1)) + 77 If (temp > 255) Then temp = temp - 255 CharacterValue(i) = CByte(temp) Next i End IfEnd Function 'In a Form' Encryption Methode by Jery MPrivate Sub Form_Load() End Sub Private Sub Label1_Change()Dim CriptVariable As IntegerDim StringBuffer As String If Len(Label1.Caption) > 0 Then 'change data from label1 back to ke label3 ReDim CharacterValue(Len(Label1.Caption) - 1) As Byte For i = 0 To (Len(Label1.Caption) - 1) CriptVariable = Asc(Mid(Label1.Caption, i + 1, 1)) - 77 If CriptVariable < 0 Then CriptVariable = CriptVariable + 255 CharacterValue(i) = CByte(CriptVariable) Next i 'show it in label3 StringBuffer = vbNullString For i = 0 To (Len(Label1.Caption) - 1) StringBuffer = StringBuffer & Chr(CharacterValue(i)) Next i Label3.Caption = StringBuffer Else MsgBox "empty"End IfEnd Sub Private Sub Text1_Change()Dim CriptVariable As IntegerDim StringBuffer As String'Ambil data yang akan dan dienkripsi If Len(Text1.Text) > 0 Then ReDim CharacterValue(Len(Text1.Text) - 1) As Byte For i = 0 To (Len(Text1.Text) - 1) CriptVariable = Asc(Mid(Text1.Text, i + 1, 1)) + 77 If (CriptVariable > 255) Then CriptVariable = CriptVariable - 255 CharacterValue(i) = CByte(CriptVariable) Next i 'show encryption in label1 StringBuffer = vbNullString For i = 0 To (Len(Text1.Text) - 1) StringBuffer = StringBuffer & Chr(CharacterValue(i)) Next i Label1.Caption = StringBuffer Else Label1.Caption = vbNullStringEnd IfEnd Sub'in a Module
' Encryption Methode by Jery M
Function Enkripsi(word As String) As String
Dim temp, temp2 As Integer
Dim temp3, temp4, temp5 As String
' file enkription
If Len(word > 0) Then
ReDim CharacterValue(Len(word) - 1) As Byte
For i = 0 To (Len(word) - 1)
temp = Asc(Mid(word, i + 1, 1)) + 77
If (temp > 255) Then temp = temp - 255
CharacterValue(i) = CByte(temp)
Next i

End If
End Function


'In a Form
' Encryption Methode by Jery M
Private Sub Form_Load()

End Sub

Private Sub Label1_Change()
Dim CriptVariable As Integer
Dim StringBuffer As String

If Len(Label1.Caption) > 0 Then
'change data from label1 back to ke label3
ReDim CharacterValue(Len(Label1.Caption) - 1) As Byte
For i = 0 To (Len(Label1.Caption) - 1)
CriptVariable = Asc(Mid(Label1.Caption, i + 1, 1)) - 77
If CriptVariable < 0 Then CriptVariable = CriptVariable + 255
CharacterValue(i) = CByte(CriptVariable)
Next i
'show it in label3
StringBuffer = vbNullString
For i = 0 To (Len(Label1.Caption) - 1)
StringBuffer = StringBuffer & Chr(CharacterValue(i))
Next i
Label3.Caption = StringBuffer

Else
MsgBox "empty"
End If
End Sub


Private Sub Text1_Change()
Dim CriptVariable As Integer
Dim StringBuffer As String
'Ambil data yang akan dan dienkripsi

If Len(Text1.Text) > 0 Then
ReDim CharacterValue(Len(Text1.Text) - 1) As Byte
For i = 0 To (Len(Text1.Text) - 1)
CriptVariable = Asc(Mid(Text1.Text, i + 1, 1)) + 77
If (CriptVariable > 255) Then CriptVariable = CriptVariable - 255
CharacterValue(i) = CByte(CriptVariable)
Next i
'show encryption in label1
StringBuffer = vbNullString
For i = 0 To (Len(Text1.Text) - 1)
StringBuffer = StringBuffer & Chr(CharacterValue(i))
Next i
Label1.Caption = StringBuffer
Else
Label1.Caption = vbNullString
End If
End Sub

MATRIX123456
Newbie Poster
1 post since Oct 2009
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You