nuttycoder Posted June 27, 2009 Share Posted June 27, 2009 Hi on my forum one of my members has created an encryption algorithm and would like to know to decrypt it, I don't understand how it work's let alone decrypt it so I was hoping someone on here might know. Here's there post: I've made the following encryption algorithm, but I need to decrypt it using PHP. Please could someone help me decrypt it. Public Function EncryptName(ByValue $EName As String) As String Declare $Temp As String, $Temp2, $Temp3 As Byte, $Temp4, $Temp5 For i = 1 To Length($EName) $Temp = $Temp & CharacterFromASCII(122 - Value(Mid($EName, i, 1))) Next i For i = 1 To Length($Temp) $Temp3 = ASCIIFromCharacter(Mid($Temp, i, 1)) If ($Temp3 >= 128) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 128 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 64) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 64 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 32) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 32 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 16) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 16 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 8 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 4) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 4 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 2) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 2 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 1) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 1 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) Next i For i = 1 To Length($Temp2) / 4 $Temp4 = 0 If (Mid($Temp2, i * 4 - 3, 1)) Then $Temp4 = $Temp4 + 8 If (Mid($Temp2, i * 4 - 2, 1)) Then $Temp4 = $Temp4 + 4 If (Mid($Temp2, i * 4 - 1, 1)) Then $Temp4 = $Temp4 + 2 If (Mid($Temp2, i * 4 - 0, 1)) Then $Temp4 = $Temp4 + 1 $Temp5 = $Temp5 & Hex($Temp4) Next i EncryptName = $Temp5 End Function Mid(String, Start, Length) returns the section of the string starting from the Start character and contains the next Length characters. First character is position 1. Example: Mid("Hello", 2, 3) will return "ell" Round(Number) will round Number to the nearest integer. Rnd will return a random number between 0 and 1. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/ Share on other sites More sharing options...
SetToLoki Posted June 27, 2009 Share Posted June 27, 2009 Hi on my forum one of my members has created an encryption algorithm and would like to know to decrypt it, I don't understand how it work's let alone decrypt it so I was hoping someone on here might know. Here's there post: I've made the following encryption algorithm, but I need to decrypt it using PHP. Please could someone help me decrypt it. Public Function EncryptName(ByValue $EName As String) As String Declare $Temp As String, $Temp2, $Temp3 As Byte, $Temp4, $Temp5 For i = 1 To Length($EName) $Temp = $Temp & CharacterFromASCII(122 - Value(Mid($EName, i, 1))) Next i For i = 1 To Length($Temp) $Temp3 = ASCIIFromCharacter(Mid($Temp, i, 1)) If ($Temp3 >= 128) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 128 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 64) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 64 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 32) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 32 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 16) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 16 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 8 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 4) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 4 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 2) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 2 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 1) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 1 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) Next i For i = 1 To Length($Temp2) / 4 $Temp4 = 0 If (Mid($Temp2, i * 4 - 3, 1)) Then $Temp4 = $Temp4 + 8 If (Mid($Temp2, i * 4 - 2, 1)) Then $Temp4 = $Temp4 + 4 If (Mid($Temp2, i * 4 - 1, 1)) Then $Temp4 = $Temp4 + 2 If (Mid($Temp2, i * 4 - 0, 1)) Then $Temp4 = $Temp4 + 1 $Temp5 = $Temp5 & Hex($Temp4) Next i EncryptName = $Temp5 End Function Mid(String, Start, Length) returns the section of the string starting from the Start character and contains the next Length characters. First character is position 1. Example: Mid("Hello", 2, 3) will return "ell" Round(Number) will round Number to the nearest integer. Rnd will return a random number between 0 and 1. thanks. doesn't seem to be wrote in php. or if it was it would throw out a ton of errors Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864408 Share on other sites More sharing options...
natepizzle Posted June 27, 2009 Share Posted June 27, 2009 I think thats C, C++, or C# Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864412 Share on other sites More sharing options...
nuttycoder Posted June 27, 2009 Author Share Posted June 27, 2009 This is what the user said about it: It's pseudocode. I put the $ in to help show what were variables. I don't know what pseudocode code is lol thought it was worth a try. thanks anyway. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864414 Share on other sites More sharing options...
Andy-H Posted June 27, 2009 Share Posted June 27, 2009 Looks like (s)he's a VB.NET programmer, did (s)he specify it to be in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864418 Share on other sites More sharing options...
nuttycoder Posted June 27, 2009 Author Share Posted June 27, 2009 yeah was posted under the php help section. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864421 Share on other sites More sharing options...
SetToLoki Posted June 27, 2009 Share Posted June 27, 2009 just did a quick search for CharacterFromASCII and according to my first two pages of results it doesn't appear to be a standard function in any language? custom function maybe or the rest is basic maths and could only presume the function CharacterFromASCII just returns the ASCII for each letter in the encoded word, you would have to work back the maths though the round is a problem as you will never know what it has been rounded up from. and for a decoder to work it would need to store the amount rounded up by somewhere. Also if it adds random things to the string it must store what's been added somewhere or you could never decode it. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864425 Share on other sites More sharing options...
nuttycoder Posted June 27, 2009 Author Share Posted June 27, 2009 yeah sounds very logical, I've pass the link for this thread on to s(he) might be of use. Thank for everyone's input much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864429 Share on other sites More sharing options...
AwptiK Posted June 27, 2009 Share Posted June 27, 2009 This is what the user said about it: It's pseudocode. I put the $ in to help show what were variables. I don't know what pseudocode code is lol thought it was worth a try. thanks anyway. pseudocode is like half-English half-code language. Usually people write that so they can get their ideas out before actually writing the entire code. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864488 Share on other sites More sharing options...
930913 Posted June 27, 2009 Share Posted June 27, 2009 It's pseudocode. Read it like English, not a programming language. It is describing what it does to the string. I want to use PHP to reverse that. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-864852 Share on other sites More sharing options...
930913 Posted June 28, 2009 Share Posted June 28, 2009 Bump. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-865230 Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 The code is pointless, its not encryption, if you read the logic your notice that. Temp = will loss any character with an ASCII value over 122, ie "{}~€" Temp2 = I love this one, it doesn't even use ANY related data to the anything used so far, its total random! Temp3 = adds and removed from the new values from temp, but that's it temp 3 isn't ever used! -Okay So far only Temp and Temp3 has ANY thing related to the data to be "encrypted"- Temp4 = use temp2 reverses the order in sets of four and added (8,4,2,1) Temp5 = the hex value from 4 concatenated as one string So the end result is built from Temp4 that's built from Temp2 that's totally random! EDIT: I'll like it if someone else could check my findings as well. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-865257 Share on other sites More sharing options...
cunoodle2 Posted June 29, 2009 Share Posted June 29, 2009 It's pseudocode. Read it like English, not a programming language. It is describing what it does to the string. I want to use PHP to reverse that. I'd suggest first learning and writing the actual function in PHP but to me it also doesn't look like it does much of anything other than to string some random things together. From there you will be able to then get a better idea as to how everything is put together and then reverse it. I could do it for a fee, or check in php freelance forum for paid assistance but no one here is going to write the entire thing for you in php (decrypt OR encrypt). Here is a rough start for you... <?php function EncryptName(ByValue $EName) { //what is "ByValue" is that a variable or a constant? $Temp = NULL; //loop through all of the individual characters of the string for ($i=0; $i < strlen($EName); $i++) { $Temp = $Temp.$Temp[$i]; //I'm not sure what "CharacterFromASCII) does nor "Value()" //ok I'll stop there!! good luck with the rest. } /* For i = 1 To Length($Temp) $Temp3 = ASCIIFromCharacter(Mid($Temp, i, 1)) If ($Temp3 >= 128) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 128 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 64) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 64 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 32) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 32 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 16) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 16 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 8 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 4) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 4 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 2) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 2 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) If ($Temp3 >= 1) Then $Temp2 = $Temp2 & "1" $Temp3 = $Temp3 - 1 Else $Temp2 = $Temp2 & "0" End If $Temp2 = $Temp2 & Round(Rnd) Next i For i = 1 To Length($Temp2) / 4 $Temp4 = 0 If (Mid($Temp2, i * 4 - 3, 1)) Then $Temp4 = $Temp4 + 8 If (Mid($Temp2, i * 4 - 2, 1)) Then $Temp4 = $Temp4 + 4 If (Mid($Temp2, i * 4 - 1, 1)) Then $Temp4 = $Temp4 + 2 If (Mid($Temp2, i * 4 - 0, 1)) Then $Temp4 = $Temp4 + 1 $Temp5 = $Temp5 & Hex($Temp4) Next i EncryptName = $Temp5 End Function */ } ?> That will get you off to a start. Try just going through line by line. Again it's hard for anyone to even tell what it does cause it is not even written in php but to me it doesn't look like anything special. I think it's one of those things that people try to over-write and they think is ultra secure but that's not necessarily the case. Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-865280 Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 but no one here is going to write the entire thing for you in php (decrypt OR encrypt). that's not 100% true, but i agree this should be in the freelance section, but i think you should read my last post before accepting to write a decrypter Quote Link to comment https://forums.phpfreaks.com/topic/163828-need-to-decrypt-an-encryption-in-php/#findComment-865281 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.