Você está na página 1de 3

Dim letter As Char

Dim strCode As String


Dim i, charsInFile, Code As Integer
Dim StreamToWrite As StreamWriter = Nothing
SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
Try
strCode = InputBox("Enter a password pin number")
If strCode = "" Then
Exit Sub
End If as dsaf sd
ds
dsfg
h
gfj
tyu
y
t
er
t
t
re
tw
erwer y
rt
yu ty
u

ui
o
kj
l,
hj
k
gh
j
dfg
dfg
dsf
e
t
gjghj
k
iu
o
ui
yu
ityuityu
tr
y
rty
r
rtert
re
t
er
t
er
t
er

ty
If Not IsNumeric(strCode) Then
MessageBox.Show("Your password pin must be numeric")
Exit Sub
End If
Code = strCode
charsInFile = txtNote.Text.Length
StreamToWrite = My.Computer.FileSystem.OpenTextFileWriter(SaveFileDialog1.FileN
ame, False)
For i = 0 To charsInFile - 1
letter = txtNote.Text.Substring(i, 1)
StreamToWrite.Write(Asc(letter) Xor Code)
StreamToWrite.Write(" ")
Next
Catch ex As Exception
MsgBox("An error occurred." & vbCrLf & ex.Message)
Finally
If StreamToWrite IsNot Nothing Then
StreamToWrite.Close()
End If
End Try
End If
******************************************************************
Dim AllText As String
Dim i As Short
Dim ch As Char
Dim strCode As String
Dim Code, Number As Integer
Dim Numbers() As String
Dim Decrypt As String = ""
OpenFileDialog1.Filter = "Text files (*.txt)|*.txt"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Try
strCode = InputBox("Enter a password pin number")
If strCode = "" Then
Exit Sub
End If
If Not IsNumeric(strCode) Then
MessageBox.Show("Your password pin must be numeric")
Exit Sub
End If
Code = CInt(strCode)
AllText = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
AllText = AllText.Trim
Numbers = AllText.Split(" ")
For i = 0 To Numbers.Length - 1
Number = CInt(Numbers(i))
ch = Chr(Number Xor Code)
Decrypt = Decrypt & ch
Next
txtNote.Text = Decrypt
lblNote.Text = String.Format("Filename: {0}", OpenFileDialog1.FileName)
txtNote.Select(0, 0)
txtNote.Enabled = True
Catch er As ArgumentException
If er.Message = "Argument 'CharCode' must be within the range of -32768 to 6553
5." Then
MessageBox.Show("Invalid Password")
Exit Sub
End If
Catch ex As Exception
MsgBox("An error occurred." & vbCrLf & ex.Message)
End Try
End If
asd ad asd asd asdasd fgrty y
try
rtyrtyrtuty
u
123g dfg
dfghrt yr
hyhjg
retryrt
yu tyuty
uyt utyu try
try
t rt
y rty
rty
try
fghfgh fghtrhgy
h
styh
st5
5syr fr5c uiknjuk fc
sxg
hytnyhjufcu
kijulkoi9u8
ol
tfx

Você também pode gostar