Re: String to SHA1 to Base 64 Encryption Help!
Aldon Moore wrote: > I am completing the integration of a payment processora and the processor > requires me to convert a string to SHA1 then to BASE64. I used a SHA1 UDF > script from Cflib.org for the conversion but in comparison to the string > created by the dotnet SHA1CryptoServiceProvider its different. Can you show the code and the two strings? 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:207379 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
RE: String to SHA1 to Base 64 Encryption Help!
Hello Jochem, Thanks for the response! Here is the VB.net code the provides the encryption: Imports System.Security.Cryptography Private Function ComputeHash(ByVal Key As String) As String Dim objSHA1 As New SHA1CryptoServiceProvider objSHA1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Key.ToCharArray)) Dim buffer() As Byte = objSHA1.Hash Dim HashValue As String = System.Convert.ToBase64String(buffer) Return HashValue End Function CFlib.org UDF: View the actual function: http://www.cflib.org/udf.cfm?ID=34 Given message=#message# The SHA-1 message digest is: #sha1(message)# -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Sunday, May 22, 2005 3:27 AM To: CF-Talk Subject: Re: String to SHA1 to Base 64 Encryption Help! Aldon Moore wrote: > I am completing the integration of a payment processora and the processor requires me to convert a string to SHA1 then to BASE64. I used a SHA1 UDF script from Cflib.org for the conversion but in comparison to the string created by the dotnet SHA1CryptoServiceProvider its different. Can you show the code and the two strings? 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:207432 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
Re: String to SHA1 to Base 64 Encryption Help!
Aldon wrote: > > Imports System.Security.Cryptography > Private Function ComputeHash(ByVal Key As String) As String > Dim objSHA1 As New SHA1CryptoServiceProvider > objSHA1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Key.ToCharArray)) > Dim buffer() As Byte = objSHA1.Hash > Dim HashValue As String = System.Convert.ToBase64String(buffer) This is Base64 encoded. > http://www.cflib.org/udf.cfm?ID=34 It looks like this is Hex. How do the strings look? 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:207514 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
RE: String to SHA1 to Base 64 Encryption Help!
Original=12345678910111213141516171819202122 Converted=iR2kmtngiYH/aVQdkkid5O4/mn0= -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 24, 2005 5:04 AM To: CF-Talk Subject: Re: String to SHA1 to Base 64 Encryption Help! Aldon wrote: > > Imports System.Security.Cryptography > Private Function ComputeHash(ByVal Key As String) As String > Dim objSHA1 As New SHA1CryptoServiceProvider > objSHA1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(Key.ToCharArray)) > Dim buffer() As Byte = objSHA1.Hash > Dim HashValue As String = System.Convert.ToBase64String(buffer) This is Base64 encoded. > http://www.cflib.org/udf.cfm?ID=34 It looks like this is Hex. How do the strings look? Jochem ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207657 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
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: Given message=#message# The Base64 encoded SHA-1 message digest is: #ToBase64(hexToString(sha1(message)))# 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:207659 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: String to SHA1 to Base 64 Encryption Help!
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. 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: Given message=#message# The Base64 encoded SHA-1 message digest is: #ToBase64(hexToString(sha1(message)))# 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
RE: String to SHA1 to Base 64 Encryption Help!
> Original= 12345678910111213141516171819202122 > Generated By .Net = iR2kmtngiYH/aVQdkkid5O4/mn0= > Generated by UDf's = w4ZFwrgMw7gBw7UeAnIlR2YICcKaw5dQTQ== Just to add to the mix, using a set of hashing components within Delphi, my SHA1 hash produces a match for the UDF generated version. The .NET version at this point looks like it is using a different digest size or it is plain wrong... The digest size used for the UDF version of the hash is 160-bit. Do you know what the digest size is for the .NET version? Paul ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208056 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54