erifash Posted March 28, 2005 Share Posted March 28, 2005 A while ago I made a cool program that "zips" a string like a zipper, but never bothered to post it (not to be confused with zipenc). Here's how it works: 1.) take a string abc 2.) take a randomly generated key 123 3.) encrypt them into their ascii codes 979899 (abc) 495051 (123) 4.) "zip" them together like a zipper 947995809591 (hex encrypted string) 0/0/0/0/0/0/ 4 9 5 0 5 1 5.) decrypt them from hex to ascii with chr() y (i'm not sure if il will display here right) Yup, so here's the code: expandcollapse popup$s = InputBox("zipstring", "string:") Do Do $enc = zipstr($s, 1) $dec = zipstr($enc, 0) Until $dec = $s $ok = MsgBox(4, "zipstr", $enc & @CRLF & $dec) Until $ok = 6 FileWrite("zipstr" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ".txt", $enc) Exit Func zipstr($str, $ed) Local $txt = "" If $ed = 1 Then $splitcstr = StringSplit(z($str), "") $splitckey = StringSplit(z(alpha(StringLen($str))), "") For $i = 1 to $splitcstr[0] $txt = $txt & $splitcstr[$i] & $splitckey[$i] Next $txt = a($txt) Return $txt EndIf If $ed = 0 Then $csplit = StringSplit(z($str), "") For $i = 1 to $csplit[0] - 1 step 2 $txt = $txt & $csplit[$i] Next $txt = a($txt) Return $txt EndIf Return 0 EndFunc Func a($text) ;decrypt Local $STRG Local $H $STRG = "" $H = $text For $i = 1 To StringLen($H) Step 2 $STRG = $STRG & Chr(Dec(StringMid($H, $i, 2))) Next Return $STRG EndFunc Func z($text) ;encrypt Local $STRG Local $H $H = "" $STRG = $text For $i = 1 To StringLen($STRG) $H = $H & String(Hex(Asc(StringMid($STRG, $i, 1)), 2)) Next Return $H EndFunc Func alpha($len) $text = "" Dim $a[86] $a[0] = 86 $r = 1 For $i = 97 to 122 $a[$r] = Chr($i) $r = $r + 1 Next $r = 1 For $i = 65 to 90 $a[$r] = Chr($i) $r = $r + 1 Next $r = 1 For $i = 48 to 57 $a[$r] = Chr($i) $r = $r + 1 Next $a[63] = "-" $a[64] = "_" $a[65] = "+" $a[66] = "=" $a[67] = "[" $a[68] = "]" $a[69] = "{" $a[70] = "}" $a[71] = "`" $a[72] = "~" $a[73] = "'" $a[74] = "!" $a[75] = "@" $a[76] = "#" $a[77] = "$" $a[78] = "%" $a[79] = "^" $a[80] = "&" $a[81] = "(" $a[82] = ")" $a[83] = ";" $a[84] = "." $a[85] = "," For $i = 1 to $len $text = $text & $a[Int(Random(1, $a[0]))] Next Return $text EndFunc What do you think? My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
erifash Posted March 28, 2005 Author Share Posted March 28, 2005 Oh, it is very good for just encrypting ONE-WORD strings like passwords and such. The mor spaces you have in the string for some reason the more time it will take to return a valid result. it must have something to do with 32 being 23 backwards... My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
zcoacoaz Posted March 29, 2005 Share Posted March 29, 2005 Check out the topic "_Basic_ Compression" or something like that it may help you make your program better. Also i think you should make a binary file encrypter lazycat has functions for binary files somewhere i think you could make a fairly good one. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now