Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / here are some encryption finction

Author
Message
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 30th Nov 2006 12:56
Here are 4 incode / decode function Plus other function. 3 of them are sime but the last one is my own design. Still an bug that i cannot fix but you might have more luck than me. It work most of the time just now and then the bug happens.

here are the function
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Nov 2006 21:12
What bug?

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Nov 2006 23:23
You have to tell us what the bug is doing before we can find it. We don't know your code like you do.

It's like taking a car to get it fixed... you don't drop off the car and say "fix it"... you have to tell them what the car is doing.
Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 1st Dec 2006 06:41
haha i have no clue at all whats going on in there, more info, specific blocks of code possibly?


Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 1st Dec 2006 12:06
Here is an break down on the function used.

Quote: "FOR X = 0 to 15
FOR Y = 0 to 15
BackUp_4_key(X,Y,0) = Number_4_Key(X,Y,0) : BackUp_4_key(X,Y,1) = Number_4_Key(X,Y,1)
NEXT Y
NEXT X"


Make an backup of the key.

Quote: "FOR N = 1 to len( string$ )
chr_val = asc( mid$( string$ , N ) )
chr_hex$ = Num_to_Nex$( chr_val )
chr_left$ = mid$( chr_hex$ , 1 ) : chr_Right$ = mid$( chr_hex$ , 2 )
Grid_X = Hex_To_Number( chr_left$ ) : Grid_Y = Hex_To_Number( chr_Right$ )
return_string$ = return_string$ + chr$( BackUp_4_key( Grid_X , Grid_Y , 0 ) )

rem change key positions
Number_4_Key_Change()

NEXT N"


convert the letter to asc number.
then convert it to HEX.
split the HEX. e.g. CF = C F
Convert the HEX to Decimal.
The two number of use to find which number to change to in the key.
the number is convert th an letter.

[/quote]Number_4_Key_Change()
Quote: "
Used to change the fist key.

"
For X = 0 to 15
FOR Y = 0 to 15
Temp_key(X,Y,0) = BackUp_4_key(X,Y,0)
Temp_key(X,Y,1) = BackUp_4_key(X,Y,1)
NEXT Y
NEXT X
Quote: "
make an backup of an backup.

"
For X = 0 to 15
FOR Y = 0 to 15
Chr_Hex$ = Num_to_Nex$( Temp_key(X,Y,1) )
IF LEN( Chr_Hex$ ) = 1 then Chr_Hex$ = "0" + Chr_Hex$
grid_X = Hex_To_Number( mid$( Chr_Hex$ , 1 ) )
Grid_Y = Hex_To_Number( mid$( Chr_Hex$ , 2 ) )
BackUp_4_key( grid_X , Grid_Y , 0 ) = Temp_key(X,Y,0)
NEXT Y
NEXT X[quote]

Each Number on the key change position. This is the smart part of the encryption. The 2 key tells which number in the first key to move to.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Dec 2006 19:25
Oh I see. You're not asking for help with a bug (because you didn't mention anything about the bug)... you're just showing us your encryption functions.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 2nd Dec 2006 11:07
The bug is that different letter are added to the return string. in encryption number 4. If you run the demo an few time you will see the bug. I think it is in the function that makes the key. I will try an other way tonight. I think of useing an list veribles, it should be easyer to use. No need to covert the letter into hex just convert it into asc value.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 5th Dec 2006 11:32
I have fix the bug here are the new function.

Login to post a reply

Server time is: 2026-07-08 03:49:09
Your offset time is: 2026-07-08 03:49:09