Hello Jochem,
i used the suggested method and the result still differs.
Original= 12345678910111213141516171819202122
Generated By .Net = iR2kmtngiYH/aVQdkkid5O4/mn0=
Generated by UDf's = w4ZFwrgMw7gBw7UeAnIlR2YICcKaw5dQTQ==

However I have managed to connect to the .net sha1.class using the following
method.

<CFOBJECT TYPE="COM" ACTION="CREATE" CLASS="System.Security.Cryptography"
NAME="shd">
<cfdump var="#shd#">

string ComputeHash(string Key)
{
SHA1CryptoServiceProvider objSHA1 = new SHA1CryptoServiceProvider;
objSHA1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Key.ToCharArray));
byte[] buffer = objSHA1.Hash;
string HashValue = System.Convert.ToBase64String(buffer);
return HashValue;
}

How do I convert this code to cfscript?

Aldon

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 25, 2005 11:46 AM
To: CF-Talk
Subject: Re: String to SHA1 to Base 64 Encryption Help!


Aldon wrote:
> Original=12345678910111213141516171819202122
> Converted=iR2kmtngiYH/aVQdkkid5O4/mn0=

I presume that is the converted output as generated by .NET? In
that case, download http://www.cflib.org/udf.cfm?ID=1016 and try:

<CFSET message="This is a test">
<CFOUTPUT>
Given message=#message#
The Base64 encoded SHA-1 message digest is:
#ToBase64(hexToString(sha1(message)))#
</CFOUTPUT>

Jochem



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208052
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to