C# Example using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace Clubsoft.Common { public class ClubsoftSSOEncryption { public string Encrypt(string valueToEncrypt, string tripleDESKey) { var valueToEncryptBytes = this.ConvertStringToBytes(valueToEncrypt); var tripleDESKeyBytes = this.ConvertHexToBytes(tripleDESKey); var valueEncrypted = this.EncryptBytes(valueToEncryptBytes, tripleDESKeyBytes); var valueHex = this.ConvertBytesToHex(valueEncrypted).ToUpper(); return valueHex; } public string Encrypt(string memberNumber, string email, string firstName, string lastName, decimal? balance, string tripleDESKey) { return Encrypt( string.Format("{0}|{1}|{2}|{3}|{4}|{5}", this.CurrentUTCDatetime(), memberNumber, email, firstName, lastName, balance.HasValue ? balance.Value.ToString("N2") : string.Empty), tripleDESKey); } private DateTime CurrentUTCDatetime() { var date = DateTime.Now; date = DateTime.SpecifyKind(date, DateTimeKind.Local); return date.ToUniversalTime(); } private byte[] ConvertStringToBytes(string value) { return Encoding.Default.GetBytes(value); } private byte[] ConvertHexToBytes(string hexValue) { return Enumerable.Range(0, hexValue.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hexValue.Substring(x, 2), 16)) .ToArray(); } private byte[] EncryptBytes(byte[] valueToEncrypt, byte[] key) { var des = new TripleDESCryptoServiceProvider(); des.Key = key; des.Mode = CipherMode.ECB; des.Padding = PaddingMode.PKCS7; ICryptoTransform ic = des.CreateEncryptor(); byte[] enc = ic.TransformFinalBlock(valueToEncrypt, 0, valueToEncrypt.Length); return enc; } private string ConvertBytesToHex(byte[] bytes) { StringBuilder sb = new StringBuilder(bytes.Length * 2); foreach (byte b in bytes) { sb.AppendFormat("{0:x2}", b); } return sb.ToString(); } } }