|
-
Sep 19th, 2003, 12:56 AM
#1
Thread Starter
So Unbanned
Fast string byte manipulation
For those of you new to strings and their ascii values, there's a very quick way to access their ascii value without using mid$ and the asc() function.
You can also build an ascii byte array to transform it back into string.
A simple, and very fast, encryption routine:
VB Code:
Dim BytAry() as Byte
Dim mStr as String
Dim x as Long
mStr = "any string"
'convert VB's BSTR(unicode) to single ASCii values
BytAry = StrConv(mStr,vbFromUnicode)
'dim encryption array
ReDim EncAry(ubound(BytAry)) as Byte
'loop
For x = 0 to ubound(BytAry)
'Xor values for a simple encryption
EncAry(x) = BytAry(x) Xor 255
Next
'Convert ascii array to unicode array so VB can directly use a unicode byte array as a string
MsgBox StrConv(EncAry,vbUnicode)
Using this method several MBs can be processed instantly(when compiled).
On my machine, Xp 1600+, 256 MB DDR, it does 35 MB/s.
Processes 1 GB in barely over 29 seconds.
Last edited by DiGiTaIErRoR; Sep 19th, 2003 at 01:02 AM.
-
Feb 9th, 2004, 09:48 AM
#2
Frenzied Member
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|