Reading Multiple Lines in a Text File
Posted on 1999-12-29
I encrypted text into a text file and I want to be able to make a kind of reader for the text file. By encrypting it again, it decrypts it. But it only decrypts the first line of the file. How would I be able to decrypt all of the lines in the text file? Here is my code:
Private Sub Command1_Click()
If Right(Text1.Text, 4) <> ".txt" Then Text1.Text = Text1.Text & ".txt"
Open Text1.Text For Input As #1
Input #1, file
secret$ = file
PassWord$ = "not-telling"
Call Encrypt(secret$, PassWord$)
Text2.Text = secret$
Sub Encrypt(secret$, PassWord$)
L = Len(PassWord$)
For X = 1 To Len(secret$)
Char = Asc(Mid$(PassWord$, (X Mod L) - L * ((X Mod L) = 0), 1))
Mid$(secret$, X, 1) = Chr$(Asc(Mid$(secret$, X, 1)) Xor Char)