Author Topic: MD5 and Array  (Read 4719 times)

Yes, but that's too slow, and I rather not use my server if more than me are going to use it.

15 ms isn't that slow.
It's a lot quicker than the time you'd spend trying to convince Badspot to add it.

You're right about that, but still, this will be used for security reasons, and sending it to a server to encrypt it isn't that secure. Neither less if the script is public and everyone knows the address to the server.


this will be used for security reasons
What exactly are you making? The CRC checks would still provide a good alternative in most cases.

You're right about that, but still, this will be used for security reasons, and sending it to a server to encrypt it isn't that secure. Neither less if the script is public and everyone knows the address to the server.

What are you trying to secure data from? There are two things you're trying to prevent:

1) A man-in-the-middle password catcher (anyone who can pull this off is going to screw you over in the end anyway)

2) Stopping other add-ons from intercepting the raw password (they can anyway using packages by pulling it out of the gui or just before it reaches the md5 function)

There is no point in encrypting data for add-ons in Blockland.

When Kalphiter stole over 5000 ID's from the database.
No, Mr. Doom took 5000 from my list. My list is all collected by me.

You rely too much of that people wont hack your system.
Your ID and IP is your password.

What will you do if it pops up random people that steals others identity through a script outside of RTB and Blockland?
1. You finished RTB Connect.
2. One random person creates a script making the same thing as you does in RTB Connect.
3. He/She/It/The person sends all required information to connect to RTB Connect with an ID that is not his.
4. He starts to hijack everything, and if he gets banned, then he continue on an another ID.
5. Several people gets baned from RTB Connect and you take the blame.

3. He/She/It/The person sends all required information to connect to RTB Connect with an ID that is not his.

Haven't you noticed that?

connect to RTB Connect with an ID that is not his.
Didn't you noticed that? The ID database can be used to get a random ID with the name for it.

Didn't you noticed that? The ID database can be used to get a random ID with the name for it.
Last time I checked, you can't steal a key out of nowhere.

First off, it would be good to have MD5 encryption included in the game, due it would be more secure to first encrypt the text, and then send it over to the server. Of course this would be best with for passwords.
http://www.torquepowered.com/community/blogs/view/4392
MD5 is a hashing algorithm, not encryption (you can't un-do it). You can do basic encryption already in torquescript, in fact my final project for my cryptology class was a cipher written in torquescript.

Secondly, I think that some people miss how easy an array should be, so I found this Array object that could be really useful, not just for storing data, but also managing everything better rather than store it in simple arrays or strings.
http://www.torquepowered.com/community/resources/view/4711
Torquescript should have real arrays to begin with. (Although I do like the naming system and export().)

Need ArrayList.
Similar to a SimObject except it add()s strings instead of objects.

Need ArrayList.

I've never used it, but:

Code: [Select]
function ArrayList::onAdd(%this)
{
%this.size = 0;

%initialCapacity = %this.initialCapacity;
%c = %this.c;

%this.initialCapacity = "";
%this.c = "";

if(mFloor(%initialCapacity) $= %initialCapacity)
{
if(%initialCapacity < 0)
{
warn(%this SPC "[ArrayList]: Illegal argument exception.");
return;
}

%this.capacity = %initialCapacity;
}

else if(%c.class $= "ArrayList")
{
for(%i = 0; %i < %c.size; %i++)
{
%this._[%this.size] = %c._[%i];
%this.size++;
}

%this.capacity = %this.size * 1.1;
}

else
%this.capacity = 10;
}

function ArrayList::add(%this,%a,%b)
{
if(%b $= "")
{
if(%this.size == %this.capacity)
return;

%this._[%this.size] = %a;
%this.size++;

return true;
}

%a = mFloor(%a);

if(%a < 0 || %a > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

for(%i = %this.size; %i > %a; %i--)
%this._[%i] = %this._[%i - 1];

%this._[%a] = %b;

if(%this.size == %this.capacity)
%this._[%this.size] = "";
else
%this.size++;

return;
}

function ArrayList::addAll(%this,%a,%b)
{
if(%b $= "")
{
if(%a.class !$= "ArrayList")
{
warn(%this SPC "[ArrayList]: Null pointer exception.");
return;
}

for(%i = 0; %i < %a.size; %i++)
{
if(%this.size == %this.capacity)
break;

%this._[%this.size] = %a._[%i];
%this.size++;
}

return true;
}

%a = mFloor(%a);

if(%a < 0 || %a > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

if(%b.class !$= "ArrayList")
{
warn(%this SPC "[ArrayList]: Null pointer exception.");
return;
}

for(%i = %this.size - 1; %i >= %a; %i--)
{
if(%i + %b.size + 1 > %this.capacity)
%this.size--;
else
%this._[%i + %b.size] = %this._[%i];
}

for(%i = 0; %i < %b.size; %i++)
{
if(%i + %a + 1 >= %this.capacity)
break;

%this._[%i + %a] = %b._[%i];
%this.size++;
}

return true;
}

function ArrayList::clear(%this)
{
for(%i = 0; %i < %this.size; %i++)
%this._[%i] = "";

%this.size = 0;
return;
}

function ArrayList::clone(%this)
{
%a = new ScriptObject()
{
class = "ArrayList";
capacity = %this.capacity;
};

for(%i = 0; %i < %this.size; %i++)
%a._[%i] = %this._[%i];

%a.size = %this.size;
return %a;
}

function ArrayList::contains(%this,%a)
{
if(isObject(%a))
%c = %a.getID();

for(%i = 0; %i < %this.size; %i++)
{
if(isObject(%this._[%i]))
%b = %this._[%i].getID();
else
%b = "";

if(%this._[%i] $= %a || (%b !$= "" && %b == %c))
return true;
}

return false;
}

function ArrayList::containsAll(%this,%a)
{
if(%a.class !$= "ArrayList")
{
warn(%this SPC "[ArrayList]: Null pointer exception.");
return;
}

for(%i = 0; %i < %a.size; %i++)
{
%skip = 0;

if(isObject(%a._[%i]))
%c = %a._[%i].getID();

for(%j = 0; %j < %this.size; %j++)
{
if(isObject(%this._[%j]))
%b = %this._[%j].getID();
else
%b = "";

if(%this._[%j] $= %a._[%i] || (%b !$= "" && %b == %c))
{
%skip = 1;
break;
}
}

if(!%skip)
return false;
}

return true;
}

function ArrayList::ensureCapacity(%this,%a)
{
%a = mFloor(%a);

if(%this.capacity < %a)
%this.capacity = %a;

return;
}

function ArrayList::get(%this,%a)
{
%a = mFloor(%a);

if(%a < 0 || %a > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

return %this._[%a];
}

function ArrayList::indexOf(%this,%a)
{
if(isObject(%a))
%c = %a.getID();

for(%i = 0; %i < %this.size; %i++)
{
if(isObject(%this._[%i]))
%b = %this._[%i].getID();
else
%b = "";

if(%this._[%i] $= %a || (%b !$= "" && %b == %c))
return %i;
}

return -1;
}

function ArrayList::isEmpty(%this)
{
if(%this.size == 0)
return true;

return false;
}

function ArrayList::iterator(%this)
{
%a = new ScriptObject()
{
class = "Iterator";
size = %this.size;
index = 0;
};

return %a;
}

function ArrayList::lastIndexOf(%this,%a)
{
if(isObject(%a))
%c = %a.getID();

for(%i = %this.size - 1; %i > -1; %i++)
{
if(isObject(%this._[%i]))
%b = %this._[%i].getID();
else
%b = "";

if(%this._[%i] $= %a || (%b !$= "" && %b == %c))
return %i;
}

return -1;
}

function ArrayList::remove(%this,%a)
{
if(isObject(%a))
{
%b = %a.getID();

for(%i = 0; %i < %this.size; %i++)
{
if(isObject(%this._[%i]))
%b = %this._[%i].getID();
else
%b = "";

if(%this._[%i] $= %a || (%b !$= "" && %b == %c))
{
for(%i = %i; %i < %this.size; %i++)
%this._[%i] = %this._[%i + 1];

%this.size--;
return true;
}
}
}

%a = mFloor(%a);

if(%a < 0 || %a > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

%b = %this._[%a];

for(%i = %a; %i < %this.size; %i++)
%this._[%i] = %this._[%i + 1];

%this.size--;
return %b;
}

function ArrayList::removeAll(%this,%a)
{
if(%b.class !$= "ArrayList")
{
warn(%this SPC "[ArrayList]: Null pointer exception.");
return;
}

for(%i = 0; %i < %a.size; %i++)
{
if(isObject(%a._[%i]))
%c = %a._[%i].getID();

for(%j = 0; %j < %this.size; %j++)
{
if(isObject(%this._[%j]))
%b = %this._[%j].getID();
else
%b = "";

if(%this._[%j] $= %a._[%i] || (%b !$= "" && %b == %c))
{
for(%k = %j; %k < %this.size; %k++)
%this._[%k] = %this._[%k + 1];

%this.size--;
%change = true;
}
}
}

return %change;
}

function ArrayList::removeRange(%this,%a,%b)
{
%a = mFloor(%a);
%b = mFloor(%b);

if(%a == %b)
return;

for(%i = %a; %i < %b; %i++)
%this._[%i] = "";

for(%i = 0; %i < %this.size - %b + 1; %i++)
%this._[%a + %i] = %this._[%b + %i];

%this.size -= %b - %a;
return;
}

function ArrayList::retainAll(%this,%a)
{
if(%b.class !$= "ArrayList")
{
warn(%this SPC "[ArrayList]: Null pointer exception.");
return;
}

for(%i = 0; %i < %a.size; %i++)
{
if(isObject(%a._[%i]))
%c = %a._[%i].getID();

for(%j = 0; %j < %this.size; %j++)
{
if(isObject(%this._[%j]))
%b = %this._[%j].getID();
else
%b = "";

if(!(%this._[%j] $= %a._[%i] || (%b !$= "" && %b == %c)))
{
for(%k = %j; %k < %this.size; %k++)
%this._[%k] = %this._[%k + 1];

%this.size--;
%change = true;
}
}
}

return %change;
}

function ArrayList::set(%this,%a,%b)
{
%a = mFloor(%a);

if(%a < 0 || %a > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

%c = %this._[%a];
%this._[%a] = %b;
return %c;
}

function ArrayList::size(%this)
{
return %this.size;
}

function ArrayList::subList(%this,%a,%b)
{
%a = mFloor(%a);
%b = mFloor(%b);

if(%a < 0 || %b > %this.size)
{
warn(%this SPC "[ArrayList]: Index out of bounds exception.");
return;
}

if(%b > %a)
{
warn(%this SPC "[ArrayList]: Illegal argument exception.");
return;
}

%c = new ScriptObject()
{
class = "ArrayList";
capacity = %b - %a;
};

for(%i = %a; %i < %b; %i++)
{
%c._[%c.size] = %this._[%i];
%c.size++;
}

return %c;
}

function ArrayList::toString(%this)
{
%str = "[";

for(%i = 0; %i < %this.size; %i++)
%str = %str @ %this._[%i] @ ", ";

return getSubStr(%str,0,strLen(%str) - 2) @ "]";
}

function ArrayList::trimToSize(%this)
{
%this.capacity = %this.size;
return;
}

function Iterator::hasNext(%this)
{
if(%this.index < %this.size)
return true;

return false;
}

function Iterator::next(%this)
{
if(%this.index == %this.size)
{
warn(%this SPC "[Iterator]: No such element exception.");
return;
}

%a = %this._[%this.index];
%this.index++;

%this.calledNext = true;
return %a;
}

function Iterator::remove(%this)
{
if(!%this.calledNext)
{
warn(%this SPC "[Iterator]: Illegal state exception.");
return;
}

for(%i = %this.index; %i < %this.size; %i++)
%this._[%i] = %this._[%i + 1];

%this.calledNext = false;
%this.size--;

%this.underlying.remove(%this.index);
return;
}

Last time I checked, you can't steal a key out of nowhere.
Ephi needs to verify what needs to be sent to the RTB Connect server to actually connect to it. I doubt he'll send the encrypted key.

MD5 is a hashing algorithm, not encryption (you can't un-do it). You can do basic encryption already in torquescript, in fact my final project for my cryptology class was a cipher written in torquescript.
Torquescript should have real arrays to begin with. (Although I do like the naming system and export().)
First, I wrote wrong, and that's my mistake.
Secondly, Arrays are nice, because how they work.

Need ArrayList.
Similar to a SimObject except it add()s strings instead of objects.
Didn't I suggested it?



Die you posting too fast people!

Ephi needs to verify what needs to be sent to the RTB Connect server to actually connect to it. I doubt he'll send the encrypted key.
That's the point, RTB checks the master server to see if the IP matches the ID