SRL Archive - Test corner

My first plugin! Pretty lame though...


R0b0t1

2007-10-13 19:09:50

Yeh, all it has is some conversion functions in it… But I finally figured out my compiling errors!



function HexToInt(Hexed: String): LongInt;
function IntToBin(Value: LongInt; Digits: Integer): String;
function BinToInt(Value: String): LongInt;

The reason some conversions are missing is because trying to convert hex to binary is like asking how to convert frozen water to ice…

But I made them into a plugin because some things I've encountered need to be manipulated as binary, and I don't think SCAR has memory streams.


HexToInt('F') = 15;
HexToInt('$F') = 15;

IntToBin(9, 4) = '1001';
IntToBin(9, 8) = '00001001';

BinToInt('1001') = 9;
BinToInt('00001001') = 9;

Boreas

2007-10-13 20:14:05

For the intobin thing, if you know how many places it needs, then your probably already know how to convert it anyway, so that second parameter isn't needed. To make it automatically figure it out, use something like
  while not (round(pow(2.0,i*1.0))>Dec) do
i:=i+1;
from here

Did you do a IntToHex?

Nice job.

R0b0t1

2007-10-13 21:19:26

No, Boreas, Delphi already has an IntToHex function. I keep getting errors when I try to make my own function with a different name, and IntToHex as the result.

I specified the length of the binary numbers because even though a byte may only need on bit, the computer still registers eight bits. Thus, when I made this function for some Base64 stuff, I still needed the extra 2 or so zeros.

mastaraymond

2007-10-14 05:57:13

From: R0b0t1
No, Boreas, Delphi already has an IntToHex function. I keep getting errors when I try to make my own function with a different name, and IntToHex as the result.

I specified the length of the binary numbers because even though a byte may only need on bit, the computer still registers eight bits. Thus, when I made this function for some Base64 stuff, I still needed the extra 2 or so zeros.

Why you put these in a plugin? If i may ask ^^. You can easily make them in scar ^^.

Markus

2007-10-14 08:19:33

From: mastaraymond
Why you put these in a plugin? If i may ask ^^. You can easily make them in scar ^^.


He wants to look cool I think (h)

But this his overkill, this compiles in scar with hardly any modification.

function HexStrToInt(Hexed: String): LongInt;
begin
If (Pos('$', Hexed) = 1) then
Result:= StrToInt(Hexed)
else
Result:= StrToInt('$' + Hexed);
end;

function IntToBin(Value: LongInt; Digits: Integer): String;
begin
Result:= StringOfChar('0', Digits) ;
while value > 0 do
begin
if (value and 1) = 1 then
Result[Digits]:= '1';
Dec(Digits) ;
Value := Value shr 1;
end;
end;

function BinToInt(Value: String): LongInt;
var
I: Integer;
begin
Result:= 0;
While (Copy(Value, 1, 1) = '0') do
Value:= Copy(Value, 2, Length(Value) - 1);

I:= Length(Value);
For I:= I downto 1 do
If (Copy(Value, I, 1) = '1') then
Result:= Result + (1 SHL (I - 1));
end;

R0b0t1

2007-10-14 14:30:57

I know, I just wanted to make a plugin :p.


Besides, since I figured plugins out, I'm making an auth system now.

Markus

2007-10-14 15:06:08

From: R0b0t1
Besides, since I figured plugins out, I'm making an auth system now.


Gimme one reason why you need a plugin for an auth system.

the scar noob

2007-10-14 15:21:41

From: Markus
Gimme one reason why you need a plugin for an auth system.


Because he wants to make it hidden?
Althought, you can with notepad :D

-Tsn.

R0b0t1

2007-10-14 15:49:54

Because how I want to. Besides, Delphi has better "resources".


And acutally, when I was done, I was thinking of holding a competition to see who can crack my Authing system.

Markus

2007-10-14 15:57:40

From: R0b0t1
Because how I want to. Besides, Delphi has better "resources".


And acutally, when I was done, I was thinking of holding a competition to see who can crack my Authing system.


You should try to crack the private auth system I'm developping with mastaraymond. It eliminates a few weaknesses all other auth systems have lol.

R0b0t1

2007-10-14 16:41:22

Kewl. What are the weaknesses other systems have? Besides the person being stupid, I don't think there are that many.

ShowerThoughts

2007-10-14 16:44:42

if authpass=''; then exit;:p

R0b0t1

2007-10-14 16:46:29

Uhm?

ShowerThoughts

2007-10-14 16:47:37

if authpass=''; then exit;

translation
Nice job good work ;) make more please!

Dark_Sniper

2007-10-14 17:19:45

From: hermpie
if authpass=''; then exit;

translation
Nice job good work ;) make more please!



wow that would be easy to hack… i would set auth pass to be anything…


now

if not authpass='MyPassword'; then exit;


is a lot harder! no one would ever be able to get it :p