developer:soap-1.4:objects:uehash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
developer:soap-1.4:objects:uehash [2010/09/10 15:05]
irina
developer:soap-1.4:objects:uehash [2011/04/11 08:54]
irina
Line 71: Line 71:
 ==== .NET C# ==== ==== .NET C# ====
 <code c> <code c>
-string pin "​1234"​;+            MD5 md5Hasher ​MD5.Create();
  
-            // Instantiate Hash +            // Convert the input string to a byte array and compute the hash. 
-            ​usaepay.ueHash hash new usaepay.ueHash(); +            ​byte[] data md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
-            hash.Type = "​md5"; ​ // Type of encryption  +
-            hash.Seed = Guid.NewGuid().ToString();  // unique encryption seed+
  
-            // Assemble string and hash +            // Create a new Stringbuilder to collect the bytes 
-            ​string prehashvalue = string.Concat(token.SourceKey,​ hash.Seed, pin); +            ​// and create a string. 
-            ​hash.HashValue ​GenerateHash(prehashvalue);+            ​StringBuilder sBuilder ​new StringBuilder();
  
-            // Add hash to token +            // Loop through each byte of the hashed data  
-            ​token.PinHash ​hash;+            ​// and format each one as a hexadecimal string. 
 +            for (int i 0; i < data.Length;​ i++) 
 +            { 
 +                sBuilder.Append(data[i].ToString("​x2"​));​ 
 +            } 
 + 
 +            // Return the hexadecimal string. 
 +            return sBuilder.ToString();
 </​code>​ </​code>​
  
developer/soap-1.4/objects/uehash.txt · Last modified: 2011/05/10 09:28 by irina

Page Tools