---- dataentry integration ----
type : integration # do not change this line
supports-foxycart-version-from : 0.7.2 # Minimum required FoxyCart version for this to work
supports-foxycart-version-to : # Last FoxyCart version that supports this (leave empty if unknown)
systems : ASP.Net, C\# # # the system(s) that the integration is for, separated with commas if more than one
name : SSO Helper code for ASP.net/cSharp # the name of the integration
description : Includes code for hashing with SHA1 #
tags_tags : cSharp, .net, asp, sso # tags, separated by commas. don't include the "system" here.
date_dt : # the date in YYYY-MM-DD format
version : # if you have a version for your code, enter it here
developer_url : # if you'd like a link back to your site, stick it here
----
====== C# SSO Helpers ======
//**Please note:**//
The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
==== SHA1 Hashing ====
private string ComputeHash(string token)
{
SHA1 sha1 = SHA1.Create();
byte[] hashData = sha1.ComputeHash(Encoding.UTF8.GetBytes(token));
StringBuilder returnValue = new StringBuilder();
for (int i = 0; i < hashData.Length; i++)
{
returnValue.Append(hashData.ToString("x2"));
}
return returnValue.ToString();
}