shai Posted December 29, 2010 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
Developers Jos Posted December 29, 2010 Developers 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.
shai Posted December 29, 2010 Author 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
Malkey Posted December 30, 2010 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
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