Difference between revisions of "UUID2Channel"

From Second Life Wiki
Jump to navigation Jump to search
(Added a suggestion to make sure not every appliance out there is using the exact same personal channels (rather self-defeating if everyone does!))
Line 13: Line 13:
integer key2Hex(key id) {
integer key2Hex(key id) {
     return -llAbs((integer)("0x" + (string) id));
     return -llAbs((integer)("0x" + (string) id));
}
</lsl>
=== Suggested Improvement ===
This generates a unique channel ID from the owner's key (change the llGetOwner() if you wish), but also XOR's it with another value, this value should be application specific.
I encountered an issue where one of the commonly used combat meters (Gorean Meter I think) is using the exact function above to generate its personal channel numbers, and starts complaining - loudly (shouts) - if you put other data on the same channel (user is flooding their own channels!).
As such you shouldn't really use the above function directly for channel IDs, if everyone did, it would negate the entire point of the function, the version below allows you to supply a random constant number to push the allocations around so we're not going to see same-user collisions between applications.
<lsl>
// modified channel generator to include per-application key, preventing cross-application collisions
// - Iain Maltz
integer generatePersonal(integer ourkey)
{
    return -llAbs( ((integer)("0x"+(string)llGetOwner())) ^ ourkey );
}
}
</lsl>
</lsl>

Revision as of 12:00, 13 November 2010

Description

Well, I've figured out a more effective way of using the UUID2Channel method, you know. The one where you put a hexadecimal prefix infront of a person's UUID. Always generates negative integers, for safety.

The Script

<lsl> // Project Neox was here. // Web Gearbox was here too

integer key2Hex(key id) {

   return -llAbs((integer)("0x" + (string) id));

} </lsl>

Suggested Improvement

This generates a unique channel ID from the owner's key (change the llGetOwner() if you wish), but also XOR's it with another value, this value should be application specific.

I encountered an issue where one of the commonly used combat meters (Gorean Meter I think) is using the exact function above to generate its personal channel numbers, and starts complaining - loudly (shouts) - if you put other data on the same channel (user is flooding their own channels!).

As such you shouldn't really use the above function directly for channel IDs, if everyone did, it would negate the entire point of the function, the version below allows you to supply a random constant number to push the allocations around so we're not going to see same-user collisions between applications.

<lsl> // modified channel generator to include per-application key, preventing cross-application collisions // - Iain Maltz

integer generatePersonal(integer ourkey) {

   return -llAbs( ((integer)("0x"+(string)llGetOwner())) ^ ourkey );

} </lsl>