Add Base Conversion Functions
complete
Signal Linden
It would be terrific to have a function or family of functions to convert between popular binary-as-text representations. This could be used, for example, to take the base64 output of
llHMAC
and convert it to the more commonly used base16 (hex) encoding.Option 1:
llBase64ToBase16(string src)
llBase16ToBase64(string src)
Option 2 (Suggestion from Bleuhazenfurfle):
string llBaseToBase(string src, string from, string into)
Rationale
Working with base64 and base16 encoded data is relatively common, (JWTs, digests, et al.) and converting between one and the other is also a frequent demand. This is currently rather arduous and expensive with LSL. As an example of a practical application: the
llHMAC
function returns base64 but most applications using HMAC expect hex.Log In
VriSeriphim Resident
First, thanks.
Second, just occurred to me that LlBaseToInteger and LlIntegerToBase would also (a) be useful and (b) more efficient in terms of server CPU usage.
This post was marked as
complete
Signal Linden
in progress
Vincent Nacon
Second option would be better, so we can expand with more new encodings in the future.
Signal Linden
tracked
Signal Linden
under review