VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From

by VisualScope (20 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 6th May 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From Just Looking At The File That WAs Saved And

Rate This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From




'this function is the encryption
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) + 99)'the 99 is the ascii value changed from password...you can change it to what ever you want as long as it's under 255
    Next i
    Encrypt = Plain
End Function

'this function is the decryption
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) - 99)'the 99 is the ascii value changed from password...you can change it to what ever you want as long as it's under 255
    Next i
    Decrypt = Encrypted
End Function


Open "YourFile" For Input As #1 
    Input #1, password'loads the password.  Example for YourFile...."c:\windows\myfile.txt
    Close #1
    password = Decrypt(password)'decrypts the password 


 password = Encrypt(password) 'encrypts password
    Open "YourFile" For Output As #1'saves the password.  Example for YourFile...."c:\windows\myfile.txt
    Print #1, password
    Close #1
    password = Decrypt(password)'use this if you are going to still use password

Download this snippet    Add to My Saved Code

This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From Comments

No comments have been posted about This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From . Why not be the first to post a comment about This Will Allow You To Encrypt As Password Right Before Use Save It So You Can Prevent Anyone From .

Post your comment

Subject:
Message:
0/1000 characters