|
Script Mode
Registered User
Join date: 21 May 2009
Posts: 3
|
05-21-2009 16:33
I am having problems.
I need to be able to convert from a hex-string (hex string, hexadecimal string) or Base64 string into a raw byte array unibyte string.
What that means is that instead of an encoded hex string where multiple characters are used to represent each byte, instead, one character is used to represent each byte.
The problem I'm having is that in LSL, control characters (byte values below 32) such as 0x00, 0x10, etc. are rendered as spaces or question marks, thus converting their byte value away from what it should be. Or at least, that's what it SEEMS like is happening.
I don't need to be able to print the string on the screen with the raw bytes rendered as characters. But what I do need to be able to do is take the result from llXorBase64StringsCorrect() and make it into a 20-char raw byte array string, then feed that into another algorithm, then take that result and convert it back into Base64.
Any help would be greatly appreciated. Thanks.
- Script Mode
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-22-2009 04:12
a you using MONO compiled scripts or LSO compiled (if you create your new script in avatar inventory, LSO is the default, if you create the new scrript from object inventory with the 'new script' button on the contents tab MONO is the deafult. open the script while it's in an object to toggle between them (there's a checkbox on the bottom)
mono should have no problem handling multibyte character strings (it uses UTF16) whereas LSO doesn't. there are hex and B64 en/de-coding functions on the lsl portal in the script library both for raw character encodings and other datatypes. (there's even a base64 key compressor on this forum if you search)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-22-2009 09:02
Have you considered changing your other algorithm's input expectations if possible? I can't think of much you can do with a raw binary byte stream in LSL without converting it back to something else, and it's a little silly to convert to the byte stream, convert back to something on which you can perform computations, convert back to a byte stream, then finally convert back to Base64 or whatever. So unless you are sending it to an external server for processing, it seems a little silly not to settle on a more practical transport format between algorithms.
|