Thanks for all the replies!!!! I have not had the chance to try them yet, but wanted to add some input regarding the following:
"I just tested that code on a 2.0MB string, and it took 3.2 seconds. This is on a core i7 Mac using the latest Xojo. I'm not sure why your version is taking 10x as long."
It's likely taking much longer, aside from the less efficient code, because the 39 seconds was for a file that is 24.8MB as opposed to 2.0MB
I am also curious as to the code regarding opening the file and dumping the contents into the rc4 method. Here's what I am using for a quick test via a temporary button I added to the Window although the code will likely go into the App open event.
Is there any faster way to improve this? I had initially dumped the textinputstream into a string variable and then passed that variable to the rc4 method; however, I decided to simple use the readall method and skip a step. I'll likely also rename the the rc4 method to some random string so its little less obvious in say a hex editor search.
Dim T as String Dim F as FolderItem Dim TextIn as TextInputStream F = GetFolderItem("").Child("myfile.txt") If F.Exists then TextIn = F.OpenAsTextFile End If If TextIn <> Nil then T = RC4(TextIn.ReadAll, "passwordstring") End If