I have this source code,
and i am getting this error
Name 'lt' is not declared.
and
Character is vaild
and ideas??
Code:
Imports System.IO
Imports System.Text
Imports System.Security.Cryptography
Module Module1
Sub Main()
End Sub
Public TheKey(7) As Byte
Private Vector() As Byte = {&H12, &H44, &H16, &HEE, &H88, &H15, &HDD, &H41}
Sub Encrypt(ByVal inName As String, ByVal outName As String)
Try
Dim storage(4096) As Byte 'create buffer
Dim totalBytesWritten As Long = 8 'Keeps track of bytes written.
Dim packageSize As Integer 'Specifies the number of bytes written at one time.
'Declare the file streams.
Dim fin As New FileStream(inName, FileMode.Open, FileAccess.Read)
Dim fout As New FileStream(outName, FileMode.OpenOrCreate, _
FileAccess.Write)
fout.SetLength(0)
Dim totalFileLength As Long = fin.Length 'Specifies the size of the source file.
'create the Crypto object
Dim des As New DESCryptoServiceProvider()
Dim crStream As New CryptoStream(fout, _
des.CreateEncryptor(TheKey, Vector), CryptoStreamMode.Write)
'flow the streams
While totalBytesWritten < totalFileLength
packageSize = fin.Read(storage, 0, 4096)
crStream.Write(storage, 0, packageSize)
totalBytesWritten = Convert.ToInt32(totalBytesWritten + packageSize / des.BlockSize * des.BlockSize)
End While
crStream.Close()
Catch e As Exception
MsgBox(e.Message)
End Try
End Sub
Sub Decrypt(ByVal inName As String, ByVal outName As String)
Try
Dim storage(4096) As Byte
Dim totalBytesWritten As Long = 8
Dim packageSize As Integer
Dim fin As New FileStream(inName, FileMode.Open, FileAccess.Read)
Dim fout As New FileStream(outName, FileMode.OpenOrCreate, _
FileAccess.Write)
fout.SetLength(0)
Dim totalFileLength As Long = fin.Length
Dim des As New DESCryptoServiceProvider()
Dim crStream As New CryptoStream(fout, _
des.CreateDecryptor(TheKey, Vector), CryptoStreamMode.Write)
Dim ex As Exception
While totalBytesWritten < totalFileLength
packageSize = fin.Read(storage, 0, 4096)
crStream.Write(storage, 0, packageSize)
totalBytesWritten = Convert.ToInt32(totalBytesWritten + packageSize / des.BlockSize * des.BlockSize)
Console.WriteLine("Processed {0} bytes, {1} bytes total", packageSize, _
totalBytesWritten)
End While
crStream.Close()
Catch e As Exception
MsgBox(e.Message & "Please ensure that you are using the correct password")
End Try
End Sub
Sub CreateKey(ByVal strKey As String)
' Byte array to hold key
Dim arrByte(7) As Byte
Dim AscEncod As New ASCIIEncoding()
Dim i As Integer = 0
AscEncod.GetBytes(strKey, i, strKey.Length, arrByte, i)
'Get the hash value of the password
Dim hashSha As New SHA1CryptoServiceProvider()
Dim arrHash() As Byte = hashSha.ComputeHash(arrByte)
'put the hash value into the key
For i = 0 To 7
TheKey(i) = arrHash(i)
Next i
End Sub
End Module
and i am getting this error
Name 'lt' is not declared.
and
Character is vaild
and ideas??
Comment