shai 0 Posted December 29, 2010 i have encrypted string. i want convert this string to normal string. this is a encryption Key: expandcollapse popup'$"' = '1' '$#' = '2' '$$' = '3' '$%' = '4' '$&' = '5' '$'' = '6' '$(' = '7' '$)' = '8' '$*' = '9' '$!' = '0' '&0' = '_' '#.' = '-' '#/' = '.' ''"' = 'a' ''#' = 'b' ''$' = 'c' ''%' = 'd' ''&' = 'e' '''' = 'f' ''(' = 'g' '')' = 'h' ''*' = 'i' ''+' = 'j' '',' = 'k' ''-' = 'l' ''.' = 'm' ''/' = 'n' ''0' = 'o' '(!' = 'p' '("' = 'q' '(#' = 'r' '($' = 's' '(%' = 't' '(&' = 'u' "('" = 'v' '((' = 'w' '()' = 'x' '(*' = 'y' '(+' = 'z' for example if i have this string: '"(&(%'0'*(% i want convret to "aotuit" thanks Share this post Link to post Share on other sites
Jos 2,214 Posted December 29, 2010 i want convret to "aotuit"thanksGreat, so what have you got so far and what is giving problems? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
shai 0 Posted December 29, 2010 by now i using this code to split the string: #include <Array.au3> _ArrayDisplay(_StringChop('$"$!$#$!$$$!',2)) Func _StringChop($string, $size) $count = Ceiling(StringLen($string)/$size) Dim $array[$count+1], $start = 1 For $i = 1 To $count $array[$i] = StringMid($string, $start, $size) $start += $size Next $array[0] = $count Return $array EndFunc but i dont know how i can convert it Share this post Link to post Share on other sites
Malkey 231 Posted December 30, 2010 Try this. expandcollapse popup; Substitution cipher Local $aArray[39][2] = [['$"', '1'],['$#', '2'],['$$', '3'],['$%', '4'],['$&', '5'],["$'", '6'],['$(', '7'], _ ['$)', '8'],['$*', '9'],['$!', '0'],['&0', '_'],['#.', '-'],['#/', '.'],['''"', 'a'],['''#', 'b'], _ ['''$', 'c'],['''%', 'd'],['''&', 'e'],["''", 'f'],["'(", 'g'],["')", 'h'],["'*", 'i'],["'+", 'j'], _ ["',", 'k'],["'-", 'l'],["'.", 'm'],["'/", 'n'],["'0", 'o'],["(!", 'p'],['("', 'q'],['(#', 'r'], _ ['($', 's'],['(%', 't'],['(&', 'u'],["('", 'v'],['((', 'w'],['()', 'x'],['(*', 'y'],['(+', 'z']] Local $sEncrypted = "'""(&(%'0'*(%" Local $sDecrypted = _Decrypt($sEncrypted) MsgBox(0, "Decryption", "Code: " & $sEncrypted & @CRLF & "Uncoded: " & $sDecrypted) Local $sText = "AutoIt" Local $sEncoded = _Encrypt($sText) MsgBox(0, "Encryption", "Text: " & $sText & @CRLF & "Coded: " & $sEncoded) Func _Decrypt($string) Local $aEncryped = StringRegExp($string, "(..)", 3) Local $sRet = "" For $i = 0 To UBound($aEncryped) - 1 For $iF = 0 To UBound($aArray) - 1 If $aArray[$iF][0] = $aEncryped[$i] Then $sRet &= $aArray[$iF][1] Next Next Return $sRet EndFunc ;==>_Decrypt Func _Encrypt($string) Local $aDecryped = StringSplit(StringLower($string), "", 2) Local $sRet = "" For $i = 0 To UBound($aDecryped) - 1 For $iF = 0 To UBound($aArray) - 1 If $aArray[$iF][1] = $aDecryped[$i] Then $sRet &= $aArray[$iF][0] Next Next Return $sRet EndFunc ;==>_Encrypt Share this post Link to post Share on other sites
shai 0 Posted December 30, 2010 its perfect. thanks for your help. Share this post Link to post Share on other sites