Sign in to follow this  
Followers 0
t0ddie

encrypting a line feed

10 posts in this topic

#1 ·  Posted (edited)

well.. i have started on my own type of encryption just for fun.. here is some partial code because i dont know if i really want to finish it since i found the _stringencrypt function

$crypt = inputbox(0,"crypt it", "please enter the text you want to encrypt!")
$length = StringLen($crypt)
$mix = Random(1, 62, 1)
$startin = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789"
$laps = ""

Dim $code[1]


    $file = FileOpen("test.txt",1)
    If @error then
        msgbox(0,"error", "file did not open")
    EndIf
    

For $x = 1 to 62
    If $mix = $x Then
        $startout = StringTrimLeft(StringTrimRight($startin,(62 - $x)),($x - 1))
        EndIf
        next
        
        $code[0] = $startout
    FileWrite($file,$code[0])
For $x = 1 To $length
    ReDim $code[$x + 1]
    If ($mix + 17) > 62 Then
        $laps = ($mix + 17) - 62
    else
        $laps = $mix + 17
    EndIf
$code[$x] = StringTrimLeft(stringtrimright($startin,($laps - 1)),($laps - ($laps - 1)))
    FileWrite($file,$code[$x])
    Next

anyways thats what i started but i found the _stringencrypt function once i got that far so i stopped.

anyways.. im doing something like this now.

#include <Constants.au3>
#include <string.au3>

$log = FileOpen("test.txt",1)
$text = "qwert6"
for $x = 1 to 12
FileWrite($log,_StringEncrypt(1,$text & @CRLF,"password",1))
Next

but i have tried @lf, @cr and @crlf and they mess up the encryption.

what i see when i encrypt and then decrypt is qwert6 then a bunch of machine language. it seems that it wont encrypt a carriage return line feed of any type.

the thing is.. i want the data to like this once it has been DEcrypted.

qwert6

qwert6

qwert6

qwert6

not like this qwert6qwert6qwert6qwert6

i understand when its encrypted that its all on one line (until it gets too far) but when its decrypted i want each "filewrite" to be on a seperate line.

so is there a workaround?

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



bumpity...

if this is not possible i have a crappy workaround where i would add the @crlf by parsing through the one big string after i have decrypted it, but that would not be as cool as adding them to the file before encrypting soo.. any ideas? ill come back in about oohh.. half an hour? lol


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i found the _stringencrypt function

Err... you're welcome ;)

Did you try this:

FileWrite($log,_StringEncrypt(1,$text & " & @CRLF ","password",1))

GL

Edit: Missed a space

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

ty ron. although that does not work either. its ok.

not that important ill just use my crappy workaround,

although if its crappy but it works.. then its not crappy lol

later


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

ty ron. although that does not work either. its ok.

not that important ill just use my crappy workaround,

although if its crappy but it works.. then its not crappy lol

later

<{POST_SNAPBACK}>

i couldn/t get rons to wrk either...but this worked

#include <Constants.au3>
#include <string.au3>

$log = FileOpen("C:\Temp\test.txt",1)
$text = "qwert6"
for $x = 1 to 12
FileWrite($log,_StringEncrypt(1,$text & @CRLF,"password",1))
;FileWrite($log,_StringEncrypt(1,$text & Chr(10) & Chr(13),"password",1))
FileWrite($log,Chr(13))

Next
FileClose($log)
sleep(500)


; open it

$log = FileOpen("C:\Temp\test.txt",0)


while 1
    
    $text = FileReadLine($log)
    If @error then Exit
    
    MsgBox(0,"test", $text)
WEnd

hope that helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Sorry, it was a shot in the dark... I mean really in the dark... I have not had the pleasure at looking at the UDF personally. I've been waiting for Patriots version to start playing with them.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Thats nice "V"!


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Sorry, it was a shot in the dark... I mean really in the dark... I have not had the pleasure at looking at the UDF personally.  I've been waiting for Patriots version to start playing with them.

<{POST_SNAPBACK}>

shoot.... ( replaces another word) ... Ron, you should have seen all the stuff i tried before i got it... just-about filled whole sciTE screen

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thats nice "V"!

<{POST_SNAPBACK}>

opppsss...

forgot to replace the message box

msgBox(0,"test2", _StringEncrypt(0,$text,"password",1))

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

bumpity...

<{POST_SNAPBACK}>

Bump...

8)


NEWHeader1.png

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