trancexx Posted February 5, 2009 Share Posted February 5, 2009 Alright, I thought so since it was rather fast. Decoding it back won't be entirely straight forward, because symbols are used multiple times. It's a real challenge."//./\Y8& | \^/^$ #Y¦//& -|-|-|/-\+ ¦ 1|£|)" Try this: expandcollapse popupGlobal $aTranslate[26][8] = [ _ ["4", "/\", "@", "/-\", "^"], _;a ["8", "6", "|3", "|>"], _;b ["[", "¢", "<", "("], _;c ["|)", "o|", "[)"], _;d ["3", "&", "£"], _;e ["|=", "ph", "|#"], _;f ["9", "6", "&;", "(_+"], _;g ["#", "[-]", "{=}", "<~>", "|-|", "]~[", "}{"], _;h ["1", "!", "|", "¦"], _;i [",|", "_|", ";"], _;j ["|<", "|{", "]{", "}<"], _;k ["1", "|", "|_", "#"], _;l ["//.", "^^", "|v|", "[V]", "{V}", "|\/|", "/\/\", "(u)"], _;m ["//", "^/ ", "|\|", "/\/", "[\]", "]\[", "<\>", "{\}"], _;n ["0", "()", "¤"], _;o ["|^", "|*", "|o", "|>", "|""", "|?"], _;p ["9", "(,)", "<|", "¶", "0."], _;q ["|2", "2", "P\", "lz", "[z"], _;r ["5", "$", "z", "§"], _;s ["7", "+", "-|-", "1"], _;t ["(_)", "|_|", "v"], _;u ["\/", "<"], _;v ["\/\/", "'//", "\^/", "(n)", "\V/"], _;w ["><"], _;x ["Y", "'/", "`/", "V/", "\-/", "j", "_v also ¥", "%"], _;y ["2", "z", "~\_", "~/_"]];z Global $sLeetText = "//./\Y8& | \^/^$ #Y¦//&; -|-|-|/-\+ ¦ 1|£|)" _WriteText($sLeetText) Func _WriteText($sLeetText) Local $sOut Local $sOut = " " Local $sS, $iIs = 2, $iMatch Local $aLeetText = StringSplit($sLeetText, "") Local $z = UBound($aLeetText) - 1 If $z > 4 Then $z = 4 EndIf For $y = 1 To $z $sS &= $aLeetText[$y] $iIs = 0 If $sS == " " Then $sLeetText = StringMid($sLeetText, StringInStr($sLeetText, " ") + 1) ConsoleWrite(" ") Return _WriteText($sLeetText) EndIf If $sS == "-|-" Then $sLeetText = StringMid($sLeetText, StringInStr($sLeetText, "-|-") + 3) ConsoleWrite("T") Return _WriteText($sLeetText) EndIf For $i = 0 To 25 For $j = 0 To 7 If $sS == " " Then $sOut &= " " $sLeetText = StringMid($sLeetText, StringInStr($sLeetText, $aLeetText[$y]) + 1) $iIs = 1 $iMatch = 1 ExitLoop 2 EndIf If $aTranslate[$i][$j] == $sS Then $sOut &= Chr($i + 65) $iIs = 1 EndIf Next Next If $iIs Then $sLeetText = StringMid($sLeetText, StringInStr($sLeetText, $aLeetText[$y]) + 1) $iMatch = 1 EndIf Next ConsoleWrite($sOut) If $iMatch Then _WriteText($sLeetText) Else ;ConsoleWrite(StringLeft($sS, 1)) If Not ($iIs = 2) Then _WriteText(StringTrimLeft($sLeetText, 1)) EndIf EndIf EndFunc ConsoleWrite(@CRLF) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Andreik Posted February 6, 2009 Share Posted February 6, 2009 Yeah, rightHe's just typing randomly. It has nothing to do with Manadars code which is not that good btw.You have issues with for example C© and V(v) , not to mention I(i) L(l) and T(t).And Andreik's english really sucks even encoded. When you talk with me do it with your mouth closed because you talk only nonsense. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
jvanegmond Posted February 6, 2009 Author Share Posted February 6, 2009 "//./\Y8& | \^/^$ #Y¦//& -|-|-|/-\+ ¦ 1|£|)"Harder than you thought then? It's not a straight forward job to reverse the translation. github.com/jvanegmond Link to comment Share on other sites More sharing options...
trancexx Posted February 6, 2009 Share Posted February 6, 2009 Harder than you thought then? It's not a straight forward job to reverse the translation. You don't see the complexity and the maximalness of posted code? I dare anyone to write better regardless of language used.@Andreik, uufff man. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
KJohn Posted February 7, 2009 Share Posted February 7, 2009 leet speak gets old fast. At first, it's facinating. Then it starts giving you a headache... I can only sympathize with a mod facing a flaming thread full of leet speak... As for Manadar's script - good one! But like already mentioned, a good decoder would be far more useful. Link to comment Share on other sites More sharing options...
Xand3r Posted February 7, 2009 Share Posted February 7, 2009 (edited) making a decoder is impossible with manadar's method simply because 1. he not only reuses the same chars but he uses the exact same chars for more than one letter example(l,i both could encode to 1 and that is impossible to translate back without a maker or something) 2. randomization .. if he would use the encoding characters in order for example first i encountered would be the first translation of i in the array the second i would get the second translation and just go from the start when it reaches the end(this would also be ok to decode) Edited February 7, 2009 by TheMadman Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
jvanegmond Posted February 7, 2009 Author Share Posted February 7, 2009 making a decoder is impossible with manadar's method simply because 1. he not only reuses the same chars but he uses the exact same chars for more than one letter example(l,i both could encode to 1 and that is impossible to translate back without a maker or something) 2. randomization .. if he would use the encoding characters in order for example first i encountered would be the first translation of i in the array the second i would get the second translation and just go from the start when it reaches the end(this would also be ok to decode)And yet the result is human readable text.. It fascinates me a bit to be honest, but I do think a decoder would be possible even though I have randomized it. No desire to write it myself though, I'm more interested in seeing what other people can make of this. :]@John, you're completely right. Noone uses leet speak as a way of communicating. github.com/jvanegmond Link to comment Share on other sites More sharing options...
storme Posted February 7, 2009 Share Posted February 7, 2009 (edited) G'day All Well I thought I'd have a bit of time off an see if I could get a translator written. The Duplicate characters were annoying but I took the easy way out and gave the read the choices so he/she could work it out themselves. Input "//./\Y8& | \^/^$ #Y¦//& -|-|-|/-\+ ¦ 1|£|)" Global $LeetText = "//./\Y8& | \^/^$ #Y¦//&; -|-|-|/-\+ ¦ 1|£|)" Output maybe {i|l} was {h|l}ying that i {i|l|t}{i|l}ed Not perfect but not bad. BTW anyone notice the R missing from tRied?? LOL BTW my Code is usually MUCH cleaner than this. But this is only a fun project so I had a little fun and this is the MESS that resulted. :\ expandcollapse popupGlobal $LeetText = "//./\Y8& | \^/^$ #Y¦//&; -|-|-|/-\+ ¦ 1|£|)" Global $aTranslate[26][9] = [ _ ["4", "/\", "@", "/-\", "^"], _;a ["8", "6", "|3", "|>"], _;b ["[", "¢", "<", "("], _;c ["|)", "o|", "[)"], _;d ["3", "&", "£"], _;e ["|=", "ph", "|#"], _;f ["9", "6", "&;", "(_+"], _;g ["#", "[-]", "{=}", "<~>", "|-|", "]~[", "}{"], _;h ["1", "!", "|", "¦"], _;i [",|", "_|", ";"], _;j ["|<", "|{", "]{", "}<"], _;k ["1", "|", "|_", "#"], _;l ["//.", "^^", "|v|", "[V]", "{V}", "|\/|", "/\/\", "(u)"], _;m ["//", "^/ ", "|\|", "/\/", "[\]", "]\[", "<\>", "{\}"], _;n ["0", "()", "¤"], _;o ["|^", "|*", "|o", "|>", "|""", "|?"], _;p ["9", "(,)", "<|", "¶", "0."], _;q ["|2", "2", "P\", "lz", "[z"], _;r ["5", "$", "z", "§"], _;s ["7", "+", "-|-", "1"], _;t ["(_)", "|_|", "v"], _;u ["\/", "<"], _;v ["\/\/", "'//", "\^/", "(n)", "\V/"], _;w ["><"], _;x ["Y", "'/", "`/", "V/", "\-/", "j", "_v", "¥", "%"], _;y ["2", "z", "~\_", "~/_"]];z Global $len1Letters[44][2] Global $len1LettersCount = 0 Global $len2Letters[44][2] Global $len2LettersCount = 0 Global $len3Letters[44][2] Global $len3LettersCount = 0 Global $len4Letters[44][2] Global $len4LettersCount = 0 ;Global $alength[5] Local $tempCount For $letter = 0 To 25 For $altern = 0 To 8 $len = StringLen($aTranslate[$letter][$altern]) ;ConsoleWriteError("4count = " & $len4LettersCount & " 3count = " & $len3LettersCount & " 2count = " & $len2LettersCount & " 1count = " & $len1LettersCount & " " & $len & @CR) Select Case $len = 4 $tempCount = checkForDuplicates($len4Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len4Letters[$len4LettersCount][0] = $aTranslate[$letter][$altern] $len4Letters[$len4LettersCount][1] = Chr(Asc("a") + $letter) $len4LettersCount += 1 Else $len4Letters[$tempCount][1] = formatDuplicates($len4Letters[$tempCount][1], $letter) EndIf Case $len = 3 $tempCount = checkForDuplicates($len3Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len3Letters[$len3LettersCount][0] = $aTranslate[$letter][$altern] $len3Letters[$len3LettersCount][1] = Chr(Asc("a") + $letter) $len3LettersCount += 1 Else $len3Letters[$tempCount][1] = formatDuplicates($len3Letters[$tempCount][1], $letter) EndIf Case $len = 2 $tempCount = checkForDuplicates($len2Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len2Letters[$len2LettersCount][0] = $aTranslate[$letter][$altern] $len2Letters[$len2LettersCount][1] = Chr(Asc("a") + $letter) $len2LettersCount += 1 Else $len2Letters[$tempCount][1] = formatDuplicates($len2Letters[$tempCount][1], $letter) EndIf Case $len = 1 $tempCount = checkForDuplicates($len1Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len1Letters[$len1LettersCount][0] = $aTranslate[$letter][$altern] $len1Letters[$len1LettersCount][1] = Chr(Asc("a") + $letter) $len1LettersCount += 1 Else $len1Letters[$tempCount][1] = formatDuplicates($len1Letters[$tempCount][1], $letter) EndIf Case Else ; catches zero length EndSelect Next Next Local $LeetTextWords = StringSplit($LeetText, " ") Local $FinalSentenance For $cword = 1 To $LeetTextWords[0] ;ConsoleWriteError("$cword[" & $cword & "] = " & $LeetTextWords[$cword] & @CR) $FinalSentenance = $FinalSentenance & translateWord($LeetTextWords[$cword]) & " " Next ConsoleWriteError("$LeetText = " & $LeetText & @CR) ConsoleWriteError("$FinalSentenance = " & $FinalSentenance & @CR) MsgBox(0,"|_||\|L33t tranlator", "L33t Text " & @CR & $LeetText & @CR & @CR & "English " & @CR& $FinalSentenance) Exit Func checkForDuplicates($array, $tchar, $tletter) ; Find l33t characters that translate to different letters For $i = 0 To UBound($array) - 1 If StringInStr($array[$i][0], $tchar) Then ConsoleWriteError($array[$i][0] & @CR) Return $i EndIf Next Return 0 EndFunc;==>checkForDuplicates Func formatDuplicates($existingString, $letter) If StringLen($existingString) > 1 Then Return StringLeft($existingString, StringLen($existingString) - 1) & "|" & Chr(Asc("a") + $letter) & "}" Else ;add new character inside the } Return "{" & $existingString & "|" & Chr(Asc("a") + $letter) & "}" EndIf EndFunc;==>formatDuplicates Func translateWord($lword) Local $tword Local $cCharacter $len = StringLen($lword) If $len >= 4 Then $cCharacter = translateChar($len4Letters, StringLeft($lword, 4)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 5, 100)) EndIf EndIf If $len >= 3 Then $cCharacter = translateChar($len3Letters, StringLeft($lword, 3)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 4, 100)) EndIf EndIf If $len >= 2 Then $cCharacter = translateChar($len2Letters, StringLeft($lword, 2)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 3, 100)) EndIf EndIf If $len >= 1 Then $cCharacter = translateChar($len1Letters, StringLeft($lword, 1)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 2, 100)) EndIf EndIf Return "" EndFunc;==>translateWord Func translateChar($array, $lChar) For $i = 0 To UBound($array) - 1 If $array[$i][0] = $lChar Then Return $array[$i][1] EndIf Next Return "" EndFunc;==>translateChar ConsoleWrite(@CRLF) IF anyone is interested I'll add a few comments. Let me know! Having some fun John Morrison Now back to the boring stuff...sigh Edited February 7, 2009 by storme Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
nikink Posted February 10, 2009 Share Posted February 10, 2009 Just a thought, you could maybe match the words with disputed letters to a dictionary. Return the word found if there's a match. If no option matches or more than one option matches, then return the current bracketted options. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted February 10, 2009 Share Posted February 10, 2009 If you made the disputed letters in to a regular expression then perhaps you could search against a dictionary.[il][hl]ying[ilt][il]edSee also http://www.autoitscript.com/forum/index.php?showtopic=5792 or possibly http://www.autoitscript.com/forum/index.php?showtopic=65814 [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
storme Posted February 10, 2009 Share Posted February 10, 2009 If you made the disputed letters in to a regular expression then perhaps you could search against a dictionary. Yep it would be a good idea the code is only a basic start. I thought of using a dictionary but don't have the time to add it to the program. It was just a bit of fun. Of course even with a dictionary it wouldn't be perfect as the word may not be a dictionary word (eg peoples names) but would improve the output. If anyone wants to add a dictionary to clean up the out then go right ahead. Here is a slightly cleaner version of the code. Should be easy to add a dictionary function that takes the output from "translateWord" function and removes the {} sections. If you were using REGEX you could easily change the {} to regex in the "formatDuplicates" function. l33t Speek.au3expandcollapse popupGlobal $len1Letters[44][2] Global $len1LettersCount = 0 Global $len2Letters[44][2] Global $len2LettersCount = 0 Global $len3Letters[44][2] Global $len3LettersCount = 0 Global $len4Letters[44][2] Global $len4LettersCount = 0 setupArrays() Global $LeetText = "//./\Y8& | \^/^$ #Y¦//&; -|-|-|/-\+ ¦ 1|£|)" ;Global $LeetText = "//.@]{£§ Y()(_) 1Y|^& 4////0Y¦//&; ^5 #£1|_" Local $FinalSentenance = translateSentenance() ConsoleWriteError("$LeetText = " & $LeetText & @CR) ConsoleWriteError("$FinalSentenance = " & $FinalSentenance & @CR) MsgBox(0, "|_||\|L33t tranlator By John Morrison", "L33t Text " & @CR & $LeetText & @CR & @CR & "English " & @CR & $FinalSentenance) Exit Func translateSentenance() Local $LeetTextWords = StringSplit($LeetText, " ") For $cword = 1 To $LeetTextWords[0] ;ConsoleWriteError("$cword[" & $cword & "] = " & $LeetTextWords[$cword] & @CR) $FinalSentenance = $FinalSentenance & translateWord($LeetTextWords[$cword]) & " " Next Return $FinalSentenance EndFunc ;==>translateSentenance Func translateWord($lword) Local $tword Local $cCharacter $len = StringLen($lword) If $len >= 4 Then $cCharacter = translateChar($len4Letters, StringLeft($lword, 4)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 5, 100)) EndIf EndIf If $len >= 3 Then $cCharacter = translateChar($len3Letters, StringLeft($lword, 3)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 4, 100)) EndIf EndIf If $len >= 2 Then $cCharacter = translateChar($len2Letters, StringLeft($lword, 2)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 3, 100)) EndIf EndIf If $len >= 1 Then $cCharacter = translateChar($len1Letters, StringLeft($lword, 1)) If $cCharacter <> "" Then Return $cCharacter & translateWord(StringMid($lword, 2, 100)) EndIf EndIf Return "" EndFunc ;==>translateWord Func translateChar($array, $lChar) For $i = 0 To UBound($array) - 1 If $array[$i][0] = $lChar Then Return $array[$i][1] EndIf Next Return "" EndFunc ;==>translateChar Func setupArrays() ;Global $alength[5] Local $aTranslate[26][9] = [ _ ["4", "/\", "@", "/-\", "^"], _;a ["8", "6", "|3", "|>"], _;b ["[", "¢", "<", "("], _;c ["|)", "o|", "[)"], _;d ["3", "&", "£"], _;e ["|=", "ph", "|#"], _;f ["9", "6", "&;", "(_+"], _;g ["#", "[-]", "{=}", "<~>", "|-|", "]~[", "}{"], _;h ["1", "!", "|", "¦"], _;i [",|", "_|", ";"], _;j ["|<", "|{", "]{", "}<"], _;k ["1", "|", "|_", "#"], _;l ["//.", "^^", "|v|", "[V]", "{V}", "|\/|", "/\/\", "(u)"], _;m ["//", "^/ ", "|\|", "/\/", "[\]", "]\[", "<\>", "{\}"], _;n ["0", "()", "¤"], _;o ["|^", "|*", "|o", "|>", "|""", "|?"], _;p ["9", "(,)", "<|", "¶", "0."], _;q ["|2", "2", "P\", "lz", "[z"], _;r ["5", "$", "z", "§"], _;s ["7", "+", "-|-", "1"], _;t ["(_)", "|_|", "v"], _;u ["\/", "<"], _;v ["\/\/", "'//", "\^/", "(n)", "\V/"], _;w ["><"], _;x ["Y", "'/", "`/", "V/", "\-/", "j", "_v", "¥", "%"], _;y ["2", "z", "~\_", "~/_"]];z Local $tempCount For $letter = 0 To 25 For $altern = 0 To 8 $len = StringLen($aTranslate[$letter][$altern]) ;ConsoleWriteError("4count = " & $len4LettersCount & " 3count = " & $len3LettersCount & " 2count = " & $len2LettersCount & " 1count = " & $len1LettersCount & " " & $len & @CR) Select Case $len = 4 $tempCount = checkForDuplicates($len4Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len4Letters[$len4LettersCount][0] = $aTranslate[$letter][$altern] $len4Letters[$len4LettersCount][1] = Chr(Asc("A") + $letter) $len4LettersCount += 1 Else $len4Letters[$tempCount][1] = formatDuplicates($len4Letters[$tempCount][1], $letter) EndIf Case $len = 3 $tempCount = checkForDuplicates($len3Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len3Letters[$len3LettersCount][0] = $aTranslate[$letter][$altern] $len3Letters[$len3LettersCount][1] = Chr(Asc("A") + $letter) $len3LettersCount += 1 Else $len3Letters[$tempCount][1] = formatDuplicates($len3Letters[$tempCount][1], $letter) EndIf Case $len = 2 $tempCount = checkForDuplicates($len2Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len2Letters[$len2LettersCount][0] = $aTranslate[$letter][$altern] $len2Letters[$len2LettersCount][1] = Chr(Asc("A") + $letter) $len2LettersCount += 1 Else $len2Letters[$tempCount][1] = formatDuplicates($len2Letters[$tempCount][1], $letter) EndIf Case $len = 1 $tempCount = checkForDuplicates($len1Letters, $aTranslate[$letter][$altern], $letter) If $tempCount = 0 Then $len1Letters[$len1LettersCount][0] = $aTranslate[$letter][$altern] $len1Letters[$len1LettersCount][1] = Chr(Asc("A") + $letter) $len1LettersCount += 1 Else $len1Letters[$tempCount][1] = formatDuplicates($len1Letters[$tempCount][1], $letter) EndIf Case Else ; catches zero length EndSelect Next Next EndFunc ;==>setupArrays Func checkForDuplicates($array, $tchar, $tletter) ; Find l33t characters that translate to different letters For $i = 0 To UBound($array) - 1 If StringInStr($array[$i][0], $tchar) Then ConsoleWriteError($array[$i][0] & @CR) Return $i EndIf Next Return 0 EndFunc ;==>checkForDuplicates Func formatDuplicates($existingString, $letter) If StringLen($existingString) > 1 Then ;add new character inside the } Return StringLeft($existingString, StringLen($existingString) - 1) & "|" & Chr(Asc("A") + $letter) & "}" Else Return "{" & $existingString & "|" & Chr(Asc("A") + $letter) & "}" EndIf EndFunc ;==>formatDuplicates Good Luck & have fun! John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E 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