Read text, convert to string and make a split in visual basic

0

Hi, I'm starting visual basic and I wanted to do the following read a file and be able to make a split knowing its delimiter. But in my case the route is going to be the same file running then I do the following:

Dim drop() As String = Split(System.IO.File.ReadAllText(Application.ExecutablePath), "[SPLITTER]")

What I was trying to do is to do both separately or at least look for another way to read my file and use a split, it just occurs to me if you want some expert to know how to do it.

At the same time what I do is encrypt:

Function unsecure(ByVal data As Byte()) As Byte()
        Using sa As New System.Security.Cryptography.RijndaelManaged
            sa.IV = New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7}
            sa.Key = New Byte() {7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1}
            Return sa.CreateDecryptor.TransformFinalBlock(data, 0, data.Length)
        End Using
    End Function
Dim drop() As String = Split(System.IO.File.ReadAllText(Application.ExecutablePath), "[SPLITTER]")

            Dim File1 As Byte() = unsecure(Convert.FromBase64String(drop(1)))
            Dim File2 As Byte() = unsecure(Convert.FromBase64String(drop(3)))

But I do not understand exactly what it does? encrypts and decrypts the chain ?. And another question is if I could dispense with it in the following way:

Dim File1 As Byte() = Convert.FromBase64String(drop(1))
Dim File2 As Byte() = Convert.FromBase64String(drop(3))

And if I ask is because I do not understand this method - > FromBase64String. I think it's to get the decoded string? I am very new in visual basic so any criticism is welcome.

    
asked by jeronimo urtado 17.12.2016 в 17:19
source

1 answer

0

Regarding the instructions related to Base64, the problem is that when a series of bytes is transmitted or recorded in text format, the bytes with a value greater than 64 are not defined within the ASCII standard.

The Base64 format encodes these bytes using two characters instead of one.

That's why you need the functions fromBase64String, to convert the encoded string in Base64 into an array of bytes.

The Base64 format is very common in the transmission of data between systems such as the MIME format.

    
answered by 17.12.2016 в 20:26