realbasic-nug
[Top] [All Lists]

Re: question on md5

To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: question on md5
From: "Seth F. Duke" <seth at johnfinley dot com>
Date: Fri, 27 Feb 2004 14:50:27 -0500
References: <10CC2EA3-688F-11D8-AA86-003065D606C2 at teachesme dot com> <D1413330-6942-11D8-A71D-000A95A072FC at sb dot org> <88DFEDAA-694B-11D8-9DED-003065D606C2 at teachesme dot com> <ECEE8950-6958-11D8-A71D-000A95A072FC at sb dot org> <B11FC58F-695B-11D8-9DED-003065D606C2 at teachesme dot com>
Create a method called something like str2hex:

Function Str2Hex(src As String, sep As String)
dim n, L, v as integer
dim s as string


L = LenB(src)
for n=1 to L
v = AscB(MidB(src, n, 1))
s = s + RightB("00"+Hex(v),2)+sep
next


return LeftB(s, LenB(s)-LenB(sep))
End Function

Then you can do something like:
s = Str2Hex(MD5(temp), "")

To convert the raw md5 to hex

I can't remember who wrote this code but I found it in the list archives.

-Seth

On Feb 27, 2004, at 2:32 PM, Sam DeVore wrote:

doesn't hex require an integer and MD5's result is a string?
<Prev in Thread] Current Thread [Next in Thread>