Page 1 of 1

What encryption is this?

Posted: Mon Nov 21, 2005 1:15 am
by GeoTrail
I have this hash or whatever it is
70617373776f7264
I'm trying to find out how it is encrypted, or which hash it is. I know the unencrypted text is password.

Any takers?

Posted: Mon Nov 21, 2005 1:46 am
by MrMat
It looks like the ascii values of each letter in "password", written in hex. So $70 = 112 = 'p', $61 = 97 = 'a', etc.

Posted: Mon Nov 21, 2005 1:59 am
by GeoTrail
Like this?
Hex(Asc("p"))

Think that is right, but how do I reverse it? How do I unencode it?

Posted: Mon Nov 21, 2005 2:03 am
by MrMat
Yes that's it. So this displays the hex string above:

Code: Select all

str.s = "password"
text.s = ""
For l = 0 To Len(str) - 1
text + Hex(PeekB(@str + l))
Next
Debug(text)

Posted: Mon Nov 21, 2005 2:08 am
by GeoTrail
That is very helpfull MrMat. How can I unencrypt a hex string created in that manner?

Posted: Mon Nov 21, 2005 2:10 am
by MrMat
It's not really encrypted so you can just PeekS it: Debug(PeekS(@str)) if it's null-terminated or Debug(PeekS(@str, length)) if you know it's length.

Posted: Mon Nov 21, 2005 2:23 am
by MrMat
That's if it is already in memory. If you are given it as a string then:

Code: Select all

Procedure.l Convert(a.s)
    ProcedureReturn FindString("0123456789abcdef", LCase(a), 1) - 1
EndProcedure

str.s = "70617373776f7264"
text.s = ""
For l = 1 To Len(str) Step 2
val.l = Convert(Mid(str, l, 1)) << 4 + Convert(Mid(str, l + 1, 1))
text + Chr(val)
Next
Debug(text)

Posted: Mon Nov 21, 2005 10:11 am
by GeoTrail
Perfect MrMat, thanks alot for your assistance.
Oh, and good morning :D

Posted: Mon Nov 21, 2005 12:10 pm
by MrMat
Glad to help and good morning to you :D