Sign in to follow this  
Followers 0
DarkNecromancer

ATEncryption, yet another encryption

14 posts in this topic

#1 ·  Posted (edited)

Hay guys, my first release but I thought it was cool so I thought I would release it to the world. This was designed for corperate level instantanious, short TCP communications, to provide fast, activly changing encryption. I was designing something for a TCP enabled application and had to develope a light weight, highly variable encryption, and out came this. This name is really lame cause I had to make it pretty for your guys to read :lmao:. Anyways alittle about it, its a key based transpositional and/or affine cipher encryption. The key can be generated or reused depending on how you use the functions. I spent alot of time time trialing just about every line of code to every line of code to get as fast as I could get it, although this wasn't what i was given to do so i couldn't made a thesis paper on it or anything. This encryption will do better in a changing enviornment, DON'T USE THIS TO PROTECT YOUR IMPORTANT DATA, it was never designed to do that. Anyways heres the source, hope you guys like it, be nice if you don't :P

CODE
Global $EncryptionVersion= "1.4.4"

#CS

+--------------------------------------------------------------+

| AT Cipher Encryption |

| ( Affine and Transpositional Cipher encryption) |

| DarkNecromancer( darknecromancer AT cox DOT net) |

+--------------------------------------------------------------+

| This is a cool little encryption I came up with for fun. I |

| have done alot of error checking, revising, and time trials|

} to make this the most efficiant encryption process I can |

| make it. I found that I could encrypt 1000 random |

| characters in about a second using a full encrypt(Affine & |

| Transpositional). You can use one or the other to get |

| better timings; in that case the encrypt and decrypt |

| functions would be your best bet, I found those times to be|

| in the 20-70 ms range, The big time booster was the matrix |

| or Affine functions of MatrixEncrypt. Have fun :( |

| |

| WARNING! This supports all character except listed below |

| '¶' & '§' & '÷' & '£' |

| If you use this, unknown problems will occur. If you need |

| these characters just replace [26][x][1] in the array |

| below with characters you wont use and your good to go |

+--------------------------------------------------------------+

Function CreateMatrix()

This will create the matrix, this must be called before

any of the Matrix functions can be called

Function Encrypt(String)

This is the final step of the whole encryption process.

This function uses the key generated by the KeyGen function

to shift characters around. This returns the encrypted string

once its done.

Function Decrypt(String)

This is designed to be called by the user to decrypt text that

was encrypted using the encrypt function. This will returns

the passed string decrypted.

Function KeyGen()

This is the Encryptions vital function. This function must

be called at least once before the any of the encrypt

functions are called. The function outputs a 10 element

array under the global variable name "Key", which contains

the 10 nonrepeating numbers 0 to 9 is the "key" variables

elements [0]-[9]

Function MatrixEncrypt(String)

The string passed to function is encrypted based on the matrix

that is generated by the CreateMatrix function. Any characters

that aren’t natively supported by the matrix are left in their

original state to make things a little more confusing. The

returned string is the encrypted form, or what it could encrypt

of the original string. Sense only native characters are

encrypted through the matrix, assuming the matrix doesn't

change, you can then decrypt the string to return the original

string.

Function MatrixDecrypt(String)

The user should pass the string that has been encrypted by

the matrix and the function will return the decrypted

text of the string. As with non native characters are

supported. If any character can't be decrypted it will

be left in its original state.

Function EncryptMove()

This function is used by the keygen command to generate the

shift difference. All the function does is execute the

equation: mod(($Key[1]+$Key[3]),$Key[9]) and return the

result. If the return is "-1.#IND" then you will have a

shift difference smaller then the base shift, otherwise,

it will always be equal to or greater then the base shift.

If the user does not call the KeyGen command, they can

still call this by using the following code

Global $EncryptMove = EncryptMove()

after they have created their key by alternative measures

Function EncryptForward(Int)

This uses the shift amout to calculate the new position for

the encrypted character. This compensates for it the

return value is greater then 26. This is used by the

MatrixEncrypt function to place all of the shifts.

Function EncryptBackward(Int)

This is the opposite of the EncryptForward function. If

find the new postition of a character while decrypting.

It compensates for when the return is less then 1. This

function is used by MatrixDecrypt.

Function MatrixShiftForward(Int)

This function is similart to the EncryptForward function only it

was changed to work with the character type selection for the

matrix array.

Function MatrixShiftBackward(Int)

This function is the opposite of the last function.

;EXAMPLE: ENCRYPTION USAGE 1

; - User Created Encryption -

#include "encryption.raumlib"

KeyGen()

CreateMatrix()

$var = inputbox("String", "Enter something to be encrypted")

$var = MatrixEncrypt($var)

$var = Encrypt($var)

msgbox(0,"",$var)

$var = MatrixDecrypt($var)

$var = Decrypt($var)

msgbox(0,"",$var)

;EXAMPLE: ENCRYPTION USAGE 2

; - User Created Encryption -

#include "encryption.raumlib"

Global $Key[10]

$Key[0] = 9

$Key[1] = 6

$Key[2] = 3

$Key[3] = 1

$Key[4] = 2

$Key[5] = 4

$Key[6] = 5

$Key[7] = 7

$Key[8] = 8

$Key[9] = 0

; NOTE, IF YOUR NOT GOING TO USE KEYGEN YOU MUST USE THIS THE KEEP THE ENCRYPTION STABLE!!!

Global $EncryptMove = EncryptMove()

CreateMatrix()

$var = inputbox("String", "Enter something to be encrypted")

$var = MatrixEncrypt($var)

$var2 = Encrypt($var)

msgbox(0,"",$var2)

$var3 = MatrixDecrypt($var2)

$var4 = Decrypt($var3)

msgbox(0,"",$var4)

#comments-end

Func CreateMatrix()

Global $matrix[27][4][2]

$matrix[0][0][0] = "a"

$matrix[0][0][1] = Asc($matrix[0][0][0])

$matrix[1][0][0] = "b"

$matrix[1][0][1] = Asc($matrix[1][0][0])

$matrix[3][0][0] = "d"

$matrix[3][0][1] = Asc($matrix[3][0][0])

$matrix[4][0][0] = "e"

$matrix[4][0][1] = Asc($matrix[4][0][0])

$matrix[5][0][0] = "f"

$matrix[5][0][1] = Asc($matrix[5][0][0])

$matrix[6][0][0] = "g"

$matrix[6][0][1] = Asc($matrix[6][0][0])

$matrix[7][0][0] = "h"

$matrix[7][0][1] = Asc($matrix[7][0][0])

$matrix[8][0][0] = "i"

$matrix[8][0][1] = Asc($matrix[8][0][0])

$matrix[9][0][0] = "j"

$matrix[9][0][1] = Asc($matrix[9][0][0])

$matrix[10][0][0] = "k"

$matrix[10][0][1] = Asc($matrix[10][0][0])

$matrix[11][0][0] = "l"

$matrix[11][0][1] = Asc($matrix[11][0][0])

$matrix[12][0][0] = "m"

$matrix[12][0][1] = Asc($matrix[12][0][0])

$matrix[13][0][0] = "n"

$matrix[13][0][1] = Asc($matrix[13][0][0])

$matrix[14][0][0] = "o"

$matrix[14][0][1] = Asc($matrix[14][0][0])

$matrix[15][0][0] = "p"

$matrix[15][0][1] = Asc($matrix[15][0][0])

$matrix[16][0][0] = "q"

$matrix[16][0][1] = Asc($matrix[16][0][0])

$matrix[17][0][0] = "r"

$matrix[17][0][1] = Asc($matrix[17][0][0])

$matrix[18][0][0] = "s"

$matrix[18][0][1] = Asc($matrix[18][0][0])

$matrix[19][0][0] = "t"

$matrix[19][0][1] = Asc($matrix[19][0][0])

$matrix[20][0][0] = "u"

$matrix[20][0][1] = Asc($matrix[20][0][0])

$matrix[21][0][0] = "v"

$matrix[21][0][1] = Asc($matrix[21][0][0])

$matrix[22][0][0] = "w"

$matrix[22][0][1] = Asc($matrix[22][0][0])

$matrix[23][0][0] = "x"

$matrix[23][0][1] = Asc($matrix[23][0][0])

$matrix[24][0][0] = "y"

$matrix[24][0][1] = Asc($matrix[24][0][0])

$matrix[25][0][0] = "z"

$matrix[25][0][1] = Asc($matrix[25][0][0])

$matrix[26][0][0] = "£"

$matrix[26][0][1] = Asc($matrix[26][0][0])

$matrix[0][1][0] = "A"

$matrix[0][1][1] = Asc($matrix[0][1][0])

$matrix[1][1][0] = "B"

$matrix[1][1][1] = Asc($matrix[1][1][0])

$matrix[2][1][0] = "C"

$matrix[2][1][1] = Asc($matrix[2][1][0])

$matrix[3][1][0] = "D"

$matrix[3][1][1] = Asc($matrix[3][1][0])

$matrix[4][1][0] = "E"

$matrix[4][1][1] = Asc($matrix[4][1][0])

$matrix[5][1][0] = "F"

$matrix[5][1][1] = Asc($matrix[5][1][0])

$matrix[6][1][0] = "G"

$matrix[6][1][1] = Asc($matrix[6][1][0])

$matrix[7][1][0] = "H"

$matrix[7][1][1] = Asc($matrix[7][1][0])

$matrix[8][1][0] = "I"

$matrix[8][1][1] = Asc($matrix[8][1][0])

$matrix[9][1][0] = "J"

$matrix[9][1][1] = Asc($matrix[9][1][0])

$matrix[10][1][0] = "K"

$matrix[10][1][1] = Asc($matrix[10][1][0])

$matrix[11][1][0] = "L"

$matrix[11][1][1] = Asc($matrix[11][1][0])

$matrix[12][1][0] = "M"

$matrix[12][1][1] = Asc($matrix[12][1][0])

$matrix[13][1][0] = "N"

$matrix[13][1][1] = Asc($matrix[13][1][0])

$matrix[14][1][0] = "O"

$matrix[14][1][1] = Asc($matrix[14][1][0])

$matrix[15][1][0] = "P"

$matrix[15][1][1] = Asc($matrix[15][1][0])

$matrix[16][1][0] = "Q"

$matrix[16][1][1] = Asc($matrix[16][1][0])

$matrix[17][1][0] = "R"

$matrix[17][1][1] = Asc($matrix[17][1][0])

$matrix[18][1][0] = "S"

$matrix[18][1][1] = Asc($matrix[18][1][0])

$matrix[19][1][0] = "T"

$matrix[19][1][1] = Asc($matrix[19][1][0])

$matrix[20][1][0] = "U"

$matrix[20][1][1] = Asc($matrix[20][1][0])

$matrix[21][1][0] = "V"

$matrix[21][1][1] = Asc($matrix[21][1][0])

$matrix[22][1][0] = "W"

$matrix[22][1][1] = Asc($matrix[22][1][0])

$matrix[23][1][0] = "X"

$matrix[23][1][1] = Asc($matrix[23][1][0])

$matrix[24][1][0] = "Y"

$matrix[24][1][1] = Asc($matrix[24][1][0])

$matrix[25][1][0] = "Z"

$matrix[25][1][1] = Asc($matrix[25][1][0])

$matrix[26][1][0] = "¶"

$matrix[26][1][1] = Asc($matrix[26][1][0])

$matrix[0][2][0] = ":"

$matrix[0][2][1] = Asc($matrix[0][2][0])

$matrix[1][2][0] = """"

$matrix[1][2][1] = Asc($matrix[1][2][0])

$matrix[2][2][0] = "("

$matrix[2][2][1] = Asc($matrix[2][2][0])

$matrix[3][2][0] = ")"

$matrix[3][2][1] = Asc($matrix[3][2][0])

$matrix[4][2][0] = "'"

$matrix[4][2][1] = Asc($matrix[4][2][0])

$matrix[5][2][0] = "~"

$matrix[5][2][1] = Asc($matrix[5][2][0])

$matrix[6][2][0] = "`"

$matrix[6][2][1] = Asc($matrix[6][2][0])

$matrix[7][2][0] = "/"

$matrix[7][2][1] = Asc($matrix[7][2][0])

$matrix[8][2][0] = "\"

$matrix[8][2][1] = Asc($matrix[8][2][0])

$matrix[9][2][0] = "."

$matrix[9][2][1] = Asc($matrix[9][2][0])

$matrix[10][2][0] = ","

$matrix[10][2][1] = Asc($matrix[10][2][0])

$matrix[11][2][0] = "?"

$matrix[11][2][1] = Asc($matrix[11][2][0])

$matrix[12][2][0] = "{"

$matrix[12][2][1] = Asc($matrix[12][2][0])

$matrix[13][2][0] = "}"

$matrix[13][2][1] = Asc($matrix[13][2][0])

$matrix[14][2][0] = "-"

$matrix[14][2][1] = Asc($matrix[14][2][0])

$matrix[15][2][0] = "+"

$matrix[15][2][1] = Asc($matrix[15][2][0])

$matrix[16][2][0] = "["

$matrix[16][2][1] = Asc($matrix[16][2][0])

$matrix[17][2][0] = "]"

$matrix[17][2][1] = Asc($matrix[17][2][0])

$matrix[18][2][0] = "!"

$matrix[18][2][1] = Asc($matrix[18][2][0])

$matrix[19][2][0] = "@"

$matrix[19][2][1] = Asc($matrix[19][2][0])

$matrix[20][2][0] = "#"

$matrix[20][2][1] = Asc($matrix[20][2][0])

$matrix[21][2][0] = "$"

$matrix[21][2][1] = Asc($matrix[21][2][0])

$matrix[22][2][0] = " "

$matrix[22][2][1] = Asc($matrix[22][2][0])

$matrix[23][2][0] = "^"

$matrix[23][2][1] = Asc($matrix[23][2][0])

$matrix[24][2][0] = "&"

$matrix[24][2][1] = Asc($matrix[24][2][0])

$matrix[25][2][0] = "*"

$matrix[25][2][1] = Asc($matrix[25][2][0])

$matrix[26][2][0] = "§"

$matrix[26][2][1] = Asc($matrix[26][2][0])

$matrix[0][3][0] = "0"

$matrix[0][3][1] = Asc($matrix[0][3][0])

$matrix[1][3][0] = "1"

$matrix[1][3][1] = Asc($matrix[1][3][0])

$matrix[2][3][0] = "2"

$matrix[2][3][1] = Asc($matrix[2][3][0])

$matrix[3][3][0] = "3"

$matrix[3][3][1] = Asc($matrix[3][3][0])

$matrix[4][3][0] = "4"

$matrix[4][3][1] = Asc($matrix[4][3][0])

$matrix[5][3][0] = "5"

$matrix[5][3][1] = Asc($matrix[5][3][0])

$matrix[6][3][0] = "6"

$matrix[6][3][1] = Asc($matrix[6][3][0])

$matrix[7][3][0] = "7"

$matrix[7][3][1] = Asc($matrix[7][3][0])

$matrix[8][3][0] = "8"

$matrix[8][3][1] = Asc($matrix[8][3][0])

$matrix[9][3][0] = "9"

$matrix[9][3][1] = Asc($matrix[9][3][0])

$matrix[10][3][0] = "¬"

$matrix[10][3][1] = Asc($matrix[10][3][0])

$matrix[11][3][0] = "%"

$matrix[11][3][1] = Asc($matrix[11][3][0])

$matrix[12][3][0] = "±"

$matrix[12][3][1] = Asc($matrix[12][3][0])

$matrix[13][3][0] = "€"

$matrix[13][3][1] = Asc($matrix[13][3][0])

$matrix[14][3][0] = "¹"

$matrix[14][3][1] = Asc($matrix[14][3][0])

$matrix[15][3][0] = "¿"

$matrix[15][3][1] = Asc($matrix[15][3][0])

$matrix[16][3][0] = "®"

$matrix[16][3][1] = Asc($matrix[16][3][0])

$matrix[17][3][0] = "‡"

$matrix[17][3][1] = Asc($matrix[17][3][0])

$matrix[18][3][0] = "†"

$matrix[18][3][1] = Asc($matrix[18][3][0])

$matrix[19][3][0] = "‰"

$matrix[19][3][1] = Asc($matrix[19][3][0])

$matrix[20][3][0] = "Š"

$matrix[20][3][1] = Asc($matrix[20][3][0])

$matrix[21][3][0] = ";"

$matrix[21][3][1] = Asc($matrix[21][3][0])

$matrix[22][3][0] = "Æ"

$matrix[22][3][1] = Asc($matrix[22][3][0])

$matrix[23][3][0] = "¦"

$matrix[23][3][1] = Asc($matrix[23][3][0])

$matrix[24][3][0] = "©"

$matrix[24][3][1] = Asc($matrix[24][3][0])

$matrix[25][3][0] = "þ"

$matrix[25][3][1] = Asc($matrix[25][3][0])

$matrix[26][3][0] = "÷"

$matrix[26][3][1] = Asc($matrix[26][3][0])

EndFunc

Func Encrypt($string)

If $String <> "" Then

Select

Case $key[5] = 1

Local $InternalSplit1 = $matrix[26][1][0]

Case $key[5] = 2

Local $InternalSplit1 = $matrix[26][2][0]

Case $key[5] = 3

Local $InternalSplit1 = $matrix[26][3][0]

Case Else

Local $InternalSplit1 = $matrix[26][0][0]

EndSelect

$string = StringReplace( $String, $InternalSplit1, "" )

; Cuts up the string to 10 character array elements

Local $Len = StringLen($string)

While StringIsDigit($Len/10) = 0

$string &= $InternalSplit1

$Len = StringLen($string)

WEnd

$Len = ($Len/10)

Local $EncryptStringArray[$len+1]

For $i = 1 to $Len

$EncryptStringArray[$i] = StringMid( $string, ((($i-1) * 10)+1), 10 )

Next

$EncryptStringArray[0] = $Len

;Reverses the encryption

Local $TempEncryptionString = ""

For $o = 1 to $EncryptStringArray[0]

Dim $TempArray[10]

For $i=0 To 9

$TempArray[$key[$i]] = StringMid ( $EncryptStringArray[$o], ($i+1), 1 )

Next

$TempEncryptionString &= $TempArray[0]&$TempArray[1]&$TempArray[2]&$TempArray[3]&$TempArray[4]&$TempArray[5]&$TempArray[6]&$TempArray[7]&$TempArray[8]&$TempArray[9]

Next

Return($TempEncryptionString)

Else

Return("")

EndIf

EndFunc

Func Decrypt($string)

If $String <> "" Then

Select

Case $key[5] = 1

Local $InternalSplit1 = $matrix[26][1][0]

Case $key[5] = 2

Local $InternalSplit1 = $matrix[26][2][0]

Case $key[5] = 3

Local $InternalSplit1 = $matrix[26][3][0]

Case Else

Local $InternalSplit1 = $matrix[26][0][0]

EndSelect

; Chops the string into 10 characters

Local $len = StringLen($string)

$len = ($len/10)

Local $DecryptStringArray[$len+1]

Dim $EncryptTempString

For $i = 1 to $len

$DecryptStringArray[$i] = StringMid( $string, ((($i-1) * 10)+1), 10 )

Next

;Reverses the encryption

$DecryptStringArray[0] = $Len

Local $Temp

For $o=1 to $DecryptStringArray[0]

For $i=0 to 9

$Temp &= StringMid( $DecryptStringArray[$o], $Key[$i]+1, 1 )

Next

Next

$temp = StringReplace ( $temp, $InternalSplit1, "" )

Return($temp)

Else

Return("")

EndIf

EndFunc

Func KeyGen()

Dim $tempkey[10]

Dim $random1, $random2, $temp1, $temp2, $temp3

Global $key[10]

For $i=0 to 9

$tempkey[$i] = $i

Next

For $i=0 to 50

$random1 = Random(0,9,1)

$random2 = Random(0,9,1)

$temp1 = $tempkey[$random1]

$temp2 = $tempkey[$random2]

$tempkey[$random1] = $temp2

$tempkey[$random2] = $temp1

Next

For $i=0 To 9

$key[$i] = $tempkey[$i]

Next

Global $EncryptMove = EncryptMove()

EndFunc

Func MatrixEncrypt($string)

Local $TempEncryptedString

For $i = 1 to StringLen($string)

Local $Change = 0

$Letter = Asc(StringMid($string,$i,1))

;~ loops through all of the array elements loooking for a match

For $o = 0 to 25

Select

Case $Letter = $matrix[$o][0][1]

$TempEncryptedString &= $matrix[EncryptForward($o)][MatrixShiftForward(0)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][1][1]

$TempEncryptedString &= $matrix[EncryptForward($o)][MatrixShiftForward(1)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][2][1]

$TempEncryptedString &= $matrix[EncryptForward($o)][MatrixShiftForward(2)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][3][1]

$TempEncryptedString &= $matrix[EncryptForward($o)][MatrixShiftForward(3)][0]

$Change = 1

$o = 28

EndSelect

Next

If $Change = 0 Then

$TempEncryptedString &= Chr($Letter)

EndIf

Next

Return($TempEncryptedString)

EndFunc

Func MatrixDecrypt($string)

Local $TempDecryptString

For $i = 1 to StringLen($string)

Local $Change = 0

$Letter = Asc(StringMid($string,$i,1))

;~ loops through all of the array elements loooking for a match

For $o = 0 to 25

Select

Case $Letter = $matrix[$o][0][1]

$TempDecryptString &= $matrix[EncryptBackward($o)][MatrixShiftBackward(0)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][1][1]

$TempDecryptString &= $matrix[EncryptBackward($o)][MatrixShiftBackward(1)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][2][1]

$TempDecryptString &= $matrix[EncryptBackward($o)][MatrixShiftBackward(2)][0]

$Change = 1

$o = 28

Case $Letter = $matrix[$o][3][1]

$TempDecryptString &= $matrix[EncryptBackward($o)][MatrixShiftBackward(3)][0]

$Change = 1

$o = 28

EndSelect

Next

If $Change = 0 Then

$TempDecryptString &= Chr($letter)

EndIf

Next

Return($TempDecryptString)

EndFunc

Func MatrixShiftForward($i)

local $MatriShift = Int(Mod( $Key[2], $key[4] )/2) + $i - 3

If $MatriShift < 0 Then

$MatriShift += 4

ElseIf $MatriShift > 3 Then

$MatriShift -= 4

EndIf

Return($MatriShift)

EndFunc

Func MatrixShiftBackward($i)

local $MatriShift = (-1 * Int(Mod( $Key[2], $key[4] )/2)) + $i + 3

If $MatriShift > 3 Then

$MatriShift -= 4

ElseIf $MatriShift <0 Then

$MatriShift += 4

EndIf

Return($MatriShift)

EndFunc

Func EncryptMove()

$Return = 7

$Data = mod( ( $Key[1] + $Key[3] ), $Key[9] )

If $Data = "-1.#IND" Then

$Return -= 1

Else

$Return += $Data

EndIf

Return( $Return )

EndFunc

Func EncryptForward( $x )

;equation: y = x + z - 25

; x = current position

; y = new position

; z = shift difference

$y = $EncryptMove + $x - 25

If $y < 0 Then

$y += 26

EndIf

Return( $y )

EndFunc

Func EncryptBackward( $x )

;equation: y = -z + 25 + x

; x = current positionx

; y = new position

; z = shift difference

$y = ( -1 * $EncryptMove ) + $x + 25

If $y > 25 Then

$y -= 26

EndIf

Return( $y )

EndFunc

enjoy :)

~Dark

Edited by DarkNecromancer

Share this post


Link to post
Share on other sites



Hmmm... adding this to my compression algorithum will produce encrypted compression...

Nice work!

But the key is a little risky though. Not as good as i'd like it, but it'll do for my purposes! :P

Share this post


Link to post
Share on other sites

any suggestions to make it better??

~Dark

Share this post


Link to post
Share on other sites

hmm, i'll see if i can work something out, thanks for the suggestion

~Dark

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ahh i realized that there was a glich in the matrix variable [0][0][0][12] and [0][0][0][20] were the same so i changed it, i also added something that would remove the two internal split characters if the provided string contained them, better to loose 2 characters then to have no or incorrect encryption returned, or possible errors. SEE FIRST POST

~Dark

Edited by DarkNecromancer

Share this post


Link to post
Share on other sites

One suggestion I have is the following. Your array is of a massive size. Granted, this probably doesnt affect performance that greatly having to initialize an array of that size, and only filling part of it. What you need your array size to be is...

Dim $matrix[26][4]
$matrix[0][0] = "a"
$matrix[1][0] = "b"
$matrix[2][0] = "c"
;etc
$matrix[0][1] = "A"
$matrix[1][1] = "B"
$matrix[2][1] = "C"
;etc
$matrix[0][2] = "0"
$matrix[1][2] = "1"
$matrix[2][2] = "2"
;etc
$matrix[0][3] = "¬"
$matrix[1][3] = "%"
$matrix[2][3] = "±"
;etc
$matrix[0][4] = ":"
$matrix[1][4] = """"
$matrix[2][4] = "("
;etc

The above suedo code should have the same affect as your code, but with less memory usage.

This is just a suggestion. No harm intended.


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

ahh that doeslook like it would use less memory, thanks for the suggestion, i need to change it at home where i can isolate the enviornment where i also have all of my tools i use to dump things out of the functions to test their functionality, and i will repost the source when i have it working. Also how do you make scrollable code section? the code sections are quite big, kind of a pain :\

EDIT:

OO i just realized that i wanted to have variable rows as well as variable cells and with your array i might be able to do it easily, have to wait and see what the corrections i made for your suggestion look like :P

~Dark

Edited by DarkNecromancer

Share this post


Link to post
Share on other sites

ahh that doeslook like it would use less memory, thanks for the suggestion, i need to change it at home where i can isolate the enviornment where i also have all of my tools i use to dump things out of the functions to test their functionality, and i will repost the source when i have it working. Also how do you make scrollable code section? the code sections are quite big, kind of a pain :\

EDIT:

OO i just realized that i wanted to have variable rows as well as variable cells and with your array i might be able to do it easily, have to wait and see what the corrections i made for your suggestion look like :P

~Dark

The memory isnt really a big deal, but I think initializing an array of that size could eventually cause some unwanted results. I am glad my code helped some.

I dont know how to do a scrolling code either. I would love to know. I have plenty of code that is long and I can never figure out how to scroll it so let me know.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

well i may have been a little unclear on what i ment by scrolling. I ment that i would it variable scroll through the characters and variable scroll through the character rows, were you thinking about text scrolling code?

I have i completed but i have some problem with the equation i'm using going over the bounds of the array, so i have some debugging to do

~Dark

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Alright, fixed the code sections on this page, from now on i'll be updating the first posts code. Also I changed the array setup like JS suggested, thanks for that one :P, and because of that change, i also added character replacement variation. IE rather then just a's going to ! or whatever it is, the replacement character is now determined by the key. I believe i worked out the bugs, finally captured a key that cause array overages and spent like 15 minutes line for line checking what it was, and working out on paper what it should be. Anyways, i'm sitting here watching the program i designed this for try to encrypt 1,525,051 characters, and its using 100% of my 2.8 P4 solidly for about 10 minutes now, and showing no signs of leting up :(. So I will be doing more benchmarking this weekend, and if need be looking for more ways to speed up with encryption process :lmao:. Enjoy

~Dark

Edited by DarkNecromancer

Share this post


Link to post
Share on other sites

I am glad my suggestion worked out for you.

Yes I did misunderstand about the scrolling code segments. I had thought you were talking about having a [ code ] segment on this forum be scrollable so that the pages wouldnt be so looooooonnng. :P

Excellent work on this so far.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Well I did some time trials and spent about 2 hours trying to lower the times and ended up get a full encryption (PLAIN -> ENCRYPTED -> PLAIN) in about 4 seconds to convert 1000 supported characters. This an alright time, but i had it lower then that by at least a third a second on each convertion, but when i made it more efficiant, the time went up, go figure :lmao:. Less lines + less loops = Time + some ?? Anyways the biggest change i made that anyone who uses this, if any :(, is the array size change. I noticed that it was called the asc conversion on 2/4 comparisons, 0-25 times, 1-strlen, so it added up, so i changed the array to store the character and the asc value of it, so the time i spent at load up any not during encryption time. I also fixed an error i noticed where the random character for spaces was forced in most cases and not on the array, which i should have been. I know some ways to speed it up some more but the problem is, to do these i would have to loose some of this encryption's flexablilty by doing on entrence character analysis, not character comparison with which i'm doing now. However to do this i would have to lock the array so a character could be indexed to be pointed directly at by the character anaysis. So yeah, i'm going to have to see about that one, but for now this works :P

~Dark

Edited by DarkNecromancer

Share this post


Link to post
Share on other sites

I pulled the version back one because I managed to screw up the decryption process by unknowningly changing how it encryped the text, but i don't have time to fix it, i have to get my software production by monday. Nothing changed other then 'how' it encrypts the data so there should be no functionalilty change.

~Dark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0