VB icon

A function that encrypts/decrypts.

Email
Submitted on: 1/2/2015 7:36:00 PM
By: m@llot (from psc cd)  
Level: Not Given
User Rating: By 7 Users
Compatibility: VB 5.0, VB 6.0
Views: 1450
 
     2 functions 1 that encrypts a passed variable(string) and the other decrypts the data(path of file) Mainly used for a single password. The code encrypts each character with a simple formula, the more characters the better the encryption. The limit on the password length is 50 characters.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A function that encrypts/decrypts.
' Description:2 functions 1 that encrypts a passed variable(string) and the other decrypts the data(path of file)
Mainly used for a single password.
The code encrypts each character with a simple formula, the more characters the better the encryption.
The limit on the password length is 50 characters.
' By: m@llot (from psc cd)
'
' Inputs:The encrypt function input is the passed variable which is the password to encrypt.
'
' Returns:The decrypt function returns the decrypted value
'
' Assumes:Its very simple, and not even close to "great" encryption. but it gets the job done for what it does.
'
' Side Effects:No side effects
'**************************************

'simple just pass the password to it like this
'Encrypt("password")
Private Function Encrypt(varPass As String)
If Dir(path to save password to) <> "" Then: Kill "path to save password to"
Dim varEncrypt As String * 50
Dim varTmp As Double
 Open "path to save password to" For Random As #1 Len = 50
For I = 1 To Len(varPass)
 varTmp = Asc(Mid$(varPass, I, 1))
 varEncrypt = Str$(((((varTmp * 1.5) / 2.1113) * 1.111119) * I))
 Put #1, I, varEncrypt
 
 
Next I
 Close #1
End Function
'returns the decrypted pass
'like if decrypt() = "password" then
Private Function Decrypt()
Open "path to save password to" For Random As #1 Len = 50
Dim varReturn As String * 50
Dim varConvert As Double
Dim varFinalPass As String
Dim varKey As Integer
For I = 1 To LOF(1) / 50
 
 
 Get #1, I, varReturn
 varConvert = Val(Trim(varReturn))
 varConvert = ((((varConvert / 1.5) * 2.1113) / 1.111119) / I)
 varFinalPass = varFinalPass & Chr(varConvert)
 
 
Next I
Decrypt = varFinalPass
 Close #1
End Function


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.