phew Posted September 4, 2008 Posted September 4, 2008 (edited) hi! password encoded: 77-106-113-117-116 password plaintext: Hallo each number stands for a char written in decimal. if its an odd number, then the decimal must be decreased by 5 and then be translated from dec to chr so you get the password plain letter. 77 / 2 == 38.5 (odd) => 77 - 5 = 72 => decimal: 72 == char: H if its an even numer, then the decimal must be decreased by 9 and then be translated from dec to chr so you get the password plain letter. 106 / 2 == 53 (even) => 106 - 9 = 97 => decimal: 97 == char: a now i am using Mod($decimal_value, 2) to find out if the decimal is even or odd, but somehow my way of decoding doesn't work properly. here is my code: decodepw("77-106-113-117-116") Func decodepw($pass) $passwd = StringSplit($pass, "-", 0) For $i = 1 To $passwd[0] MsgBox(0, "", $passwd[$i]) $x = Mod($passwd[$i], 2) If ($x = 0) Then MsgBox(0, "", Chr($passwd[$i] - 9)) Else MsgBox(0, "", Chr($passwd[$i] - 5)) EndIf Next EndFunc decoding with my code gives out smtn like: Halp<strange sign> should be: Hallo what am i doing wrong? EDIT: "odd" and "even" might be the wrong words, well if Mod() returns 0 then -9 if it returns 1 then -5 =) sorry for my bad english greetings Edited September 4, 2008 by phew
Moderators SmOke_N Posted September 4, 2008 Moderators Posted September 4, 2008 You're trying to subtract a string value from an integer. MsgBox(0, 0, decodepw("77-106-113-117-116")) Func decodepw($pass) Local $passwd = StringSplit($pass, "-", 0) Local $s_hold = "" For $i = 1 To $passwd[0] If Mod($passwd[$i], 2) Then $s_hold &= Chr(Int($passwd[$i]) - 5) Else $s_hold &= Chr(Int($passwd[$i]) - 9) EndIf Next Return $s_hold EndFunc 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.
phew Posted September 4, 2008 Author Posted September 4, 2008 Func decodepw($pass) $passwd = StringSplit($pass, "-", 0) For $i = 1 To $passwd[0] MsgBox(0, "", $passwd[$i]) $x = Mod($passwd[$i], 2) If ($x = 0) Then MsgBox(0, "", Chr(Int($passwd[$i]) - 9)) Else MsgBox(0, "", Chr(Int($passwd[$i]) - 5)) EndIf Next EndFunc doesn't work either, your code also returns "Halpk" instead of "Hallo" for me
trancexx Posted September 4, 2008 Posted September 4, 2008 (edited) Func decodepw($pass) $passwd = StringSplit($pass, "-", 0) For $i = 1 To $passwd[0] MsgBox(0, "", $passwd[$i]) $x = Mod($passwd[$i], 2) If ($x = 0) Then MsgBox(0, "", Chr(Int($passwd[$i]) - 9)) Else MsgBox(0, "", Chr(Int($passwd[$i]) - 5)) EndIf Next EndFunc doesn't work either, your code also returns "Halpk" instead of "Hallo" for meThat's because "77-106-113-113-120" is "Hallo" and "77-106-113-117-116" is... "Halpk" Edited September 4, 2008 by trancexx ♡♡♡ . eMyvnE
phew Posted September 4, 2008 Author Posted September 4, 2008 mhh strange, so it's encoded in some other way. a friend of mine made me a msl script that decodes correctly, perhaps one of you knows msl and can figure out what i'm doing wrong by then: alias dc { var %char 0 var %i 1 var %output "" while ($gettok($1-,%i,45)) { set %char $gettok($1-,%i,45) if ($calc(%i % 2) == 0) { set %output $+(%output, $chr($calc(%char - 9))) } if ($calc(%i % 2) == 1) { set %output $+(%output, $chr($calc(%char - 5))) } inc %i } echo $active %output } test passwords: encoded plaintext 77-106-113-117-116 - Hallo 60-61-58-60-55-58-59 - 7453216 103-123-102-126-120-110 - brause
Moderators SmOke_N Posted September 4, 2008 Moderators Posted September 4, 2008 mhh strange, so it's encoded in some other way. a friend of mine made me a msl script that decodes correctly, perhaps one of you knows msl and can figure out what i'm doing wrong by then: alias dc { var %char 0 var %i 1 var %output "" while ($gettok($1-,%i,45)) { set %char $gettok($1-,%i,45) if ($calc(%i % 2) == 0) { set %output $+(%output, $chr($calc(%char - 9))) } if ($calc(%i % 2) == 1) { set %output $+(%output, $chr($calc(%char - 5))) } inc %i } echo $active %output } test passwords: encoded plaintext 77-106-113-117-116 - Hallo 60-61-58-60-55-58-59 - 7453216 103-123-102-126-120-110 - brauseWhat language is that? Anyway, it's not using the decimal of the char to figure out the mod... it's using the loop number. MsgBox(0, 0, decodepw("77-106-113-117-116")) #cs 77-106-113-117-116 - Hallo 60-61-58-60-55-58-59 - 7453216 103-123-102-126-120-110 - brause #ce Func decodepw($pass) Local $passwd = StringSplit($pass, "-", 0) Local $s_hold = "" For $i = 1 To $passwd[0] If Mod($i, 2) Then $s_hold &= Chr(Int($passwd[$i]) - 5) Else $s_hold &= Chr(Int($passwd[$i]) - 9) EndIf Next Return $s_hold EndFunc($calc(%i % 2) == 1) 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.
phew Posted September 4, 2008 Author Posted September 4, 2008 the language is called msl (mirc scripting language). thank you very much! such a simple mistake with such effect and effort.. thanks again, greetings
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