Search Tools Links Login

Encrypt/Decrypt Text with Ease


Visual Basic 6, or VB Classic

This is an awesome encryption algorithm that you can you really use to encrypt and decrypt text. It works on multiline textboxes and singleline as well...Have PHUN!

Original Author: VisualBlind

Code

'.......................................................
'to encrypt:
'right before you save you go:
'password = Encrypt(password) password is the variable
'.......................................................
Public Function Encrypt(ByVal Plain As String)
  Dim Letter As String
  For i = 1 To Len(Plain)
    Letter = Mid$(Plain, i, 1)
    Mid$(Plain, i, 1) = Chr(Asc(Letter) + 111)
  Next i
  Encrypt = Plain
End Function
'password = Encrypt(Text1)
'Text2 = password

'...................................................
'to decrypt:
'right before you load the password you go:
'password = Decrypt(password)
'....................................................
Public Function Decrypt(ByVal Encrypted As String)
Dim Letter As String
  For i = 1 To Len(Encrypted)
    Letter = Mid$(Encrypted, i, 1)
    Mid$(Encrypted, i, 1) = Chr(Asc(Letter) - 111)
  Next i
  Decrypt = Encrypted
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 117 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.