{"_id":"5632a5ea49e16d0d001224a2","version":{"_id":"5632a5e549e16d0d00122443","__v":6,"project":"55b933b3146ef121002158d3","createdAt":"2015-10-29T23:04:05.701Z","releaseDate":"2015-10-29T23:04:05.701Z","categories":["5632a5e749e16d0d00122444","5632a5e749e16d0d00122445","5632a5e749e16d0d00122446","5632a5e749e16d0d00122447","5632a5e749e16d0d00122448","5632a5e749e16d0d00122449","5632a5e749e16d0d0012244a","5632a5e749e16d0d0012244b","5632a5e749e16d0d0012244c","5632a5e749e16d0d0012244d","5632a5e749e16d0d0012244e","5632a5e749e16d0d0012244f","5632a5e749e16d0d00122450","5632b179df556c0d00cd095b","564e13053b2b4a19000cd69b","59caa9df65accc001a489c95","59cab50965accc001a489d28","59cadd464ab7b70024378e74"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"__v":0,"project":"55b933b3146ef121002158d3","user":"55b932ba8fd1a02b00f496c8","githubsync":"","category":{"_id":"5632a5e749e16d0d0012244d","__v":1,"pages":["5632a5ea49e16d0d00122481","5632a5ea49e16d0d00122482","5632a5ea49e16d0d00122483","5632a5ea49e16d0d00122484","5632a5ea49e16d0d00122485","5632a5ea49e16d0d00122486","5632a5ea49e16d0d00122487","5632a5ea49e16d0d00122488","5632a5ea49e16d0d00122489","5632a5ea49e16d0d0012248a","5632a5ea49e16d0d0012248b","5632a5ea49e16d0d0012248c","5632a5ea49e16d0d0012248d","5632a5ea49e16d0d0012248e","5632a5ea49e16d0d0012248f","5632a5ea49e16d0d00122490","5632a5ea49e16d0d00122491","5632a5ea49e16d0d00122492","5632a5ea49e16d0d00122493","5632a5ea49e16d0d00122494","5632a5ea49e16d0d00122495","5632a5ea49e16d0d00122496","5632a5ea49e16d0d00122497","5632a5ea49e16d0d00122498","5632a5ea49e16d0d00122499","5632a5ea49e16d0d0012249a","5632a5ea49e16d0d0012249b","5632a5ea49e16d0d0012249c","5632a5ea49e16d0d0012249d","5632a5ea49e16d0d0012249e","5632a5ea49e16d0d0012249f","5632a5ea49e16d0d001224a0","5632a5ea49e16d0d001224a1","5632a5ea49e16d0d001224a2","5632a5ea49e16d0d001224a3","5632a5ea49e16d0d001224a4","5632a5ea49e16d0d001224a5","5632a5ea49e16d0d001224a6","5632a5ea49e16d0d001224a7"],"project":"55b933b3146ef121002158d3","version":"5632a5e549e16d0d00122443","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-04T17:34:02.800Z","from_sync":false,"order":12,"slug":"objects","title":"Objects"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-04T17:59:16.329Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":32,"body":"Defines the properties of the hash used to validate a source key.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Description\"\n}\n[/block]\nThis object defines the properties of the hash used to validate a source key. This object is only required on source keys that have a pin assigned.\nPins are not meant to be stored by the application. Instead the application should prompt the end user for the pin. The pin may be cached temporarily, but should not be stored permanently unless appropriate security measures such as strong encryption are taken.\nPlease note that access to certain methods will require a pin. These features are restricted to sources with a pin to minimize the impact of a merchant's source key being stolen.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Name\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"string\",\n    \"0-1\": \"Type\",\n    \"0-2\": \"Hashing Function Used: Currently only “md5” and “sha1” are supported.\",\n    \"1-0\": \"string\",\n    \"1-1\": \"Seed\",\n    \"1-2\": \"The data used to seed the hash: This value must be unique and cannot be reused. The system will reject the request if a Seed is reused. The reason for this is to minimize the damage if a HashValue is stolen. An intruder may manage to obtain a SourceKey and a HashValue, but will not be able to use the source key since the HashValue is based on a seed that cannot be reused.\",\n    \"2-0\": \"string\",\n    \"2-1\": \"HashValue\",\n    \"2-2\": \"Hash string: The resulting hash. The hash is calculated by concatenating the SourceKey, the Seed and the Pin value. Do not place any characters in between these values. Once the values have been concatenated, calculate the hash string using the algorithm specified by Type.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples\"\n}\n[/block]\n## Visual Basic (.Net) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Dim hash As eBizCharge.ueHash = New eBizCharge.ueHash\\nDim sourcekey As String\\n Dim pin As String\\n ' The source key and pin are created by the merchant\\n sourcekey = \\\"e42SYc86C4uvlvyP62ow54Kv93SZsJVm\\\"\\n pin = \\\"1234\\\"\\n token = New eBizCharge.ueSecurityToken\\n token.SourceKey = sourcekey\\n ' To create the hash we must concat the sourcekey, seed and pin\\n Dim rand As System.Random = New System.Random\\n hash.Seed = Date.Now.ToUniversalTime & rand.Next()\\n Dim prehashvalue As String\\n prehashvalue = sourcekey & hash.Seed & pin\\n ' Generate the md5 hash\\n hash.Type = \\\"md5\\\"\\n hash.HashValue = GenerateHash(prehashvalue)\\n token.PinHash = hash\\nPrivate Function GenerateHash(ByVal SourceText As String) As String\\n 'Instantiate an MD5 Provider object\\n Dim md5 As New MD5CryptoServiceProvider\\n 'Compute the hash value from the source\\n Dim ByteHash() As Byte = md5.ComputeHash(Encoding.Default.GetBytes(SourceText))\\n 'Instantiate a StringBuilder object\\n Dim sb As New StringBuilder\\n 'Repack binary hash as hex\\n For c As Integer = 0 To ByteHash.Length - 1\\n   sb.AppendFormat(\\\"{0:x2}\\\", ByteHash(c))\\n Next c\\n 'Return the hex hash\\n Return sb.ToString\\nEnd Function\",\n      \"language\": \"asp\"\n    }\n  ]\n}\n[/block]\n## C Sharp (.Net)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"MD5 md5Hasher = MD5.Create();\\n           // Convert the input string to a byte array and compute the hash.\\n           byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));\\n           // Create a new Stringbuilder to collect the bytes\\n           // and create a string.\\n           StringBuilder sBuilder = new StringBuilder();\\n           // Loop through each byte of the hashed data\\n           // and format each one as a hexadecimal string.\\n           for (int i = 0; i < data.Length; i++)\\n           {\\n               sBuilder.Append(data[i].ToString(\\\"x2\\\"));\\n           }\\n           // Return the hexadecimal string.\\n           return sBuilder.ToString();\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"uehash","type":"basic","title":"ueHash"}
Defines the properties of the hash used to validate a source key. [block:api-header] { "type": "basic", "title": "Description" } [/block] This object defines the properties of the hash used to validate a source key. This object is only required on source keys that have a pin assigned. Pins are not meant to be stored by the application. Instead the application should prompt the end user for the pin. The pin may be cached temporarily, but should not be stored permanently unless appropriate security measures such as strong encryption are taken. Please note that access to certain methods will require a pin. These features are restricted to sources with a pin to minimize the impact of a merchant's source key being stolen. [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Type", "h-1": "Name", "h-2": "Description", "0-0": "string", "0-1": "Type", "0-2": "Hashing Function Used: Currently only “md5” and “sha1” are supported.", "1-0": "string", "1-1": "Seed", "1-2": "The data used to seed the hash: This value must be unique and cannot be reused. The system will reject the request if a Seed is reused. The reason for this is to minimize the damage if a HashValue is stolen. An intruder may manage to obtain a SourceKey and a HashValue, but will not be able to use the source key since the HashValue is based on a seed that cannot be reused.", "2-0": "string", "2-1": "HashValue", "2-2": "Hash string: The resulting hash. The hash is calculated by concatenating the SourceKey, the Seed and the Pin value. Do not place any characters in between these values. Once the values have been concatenated, calculate the hash string using the algorithm specified by Type." }, "cols": 3, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "Examples" } [/block] ## Visual Basic (.Net) [block:code] { "codes": [ { "code": "Dim hash As eBizCharge.ueHash = New eBizCharge.ueHash\nDim sourcekey As String\n Dim pin As String\n ' The source key and pin are created by the merchant\n sourcekey = \"e42SYc86C4uvlvyP62ow54Kv93SZsJVm\"\n pin = \"1234\"\n token = New eBizCharge.ueSecurityToken\n token.SourceKey = sourcekey\n ' To create the hash we must concat the sourcekey, seed and pin\n Dim rand As System.Random = New System.Random\n hash.Seed = Date.Now.ToUniversalTime & rand.Next()\n Dim prehashvalue As String\n prehashvalue = sourcekey & hash.Seed & pin\n ' Generate the md5 hash\n hash.Type = \"md5\"\n hash.HashValue = GenerateHash(prehashvalue)\n token.PinHash = hash\nPrivate Function GenerateHash(ByVal SourceText As String) As String\n 'Instantiate an MD5 Provider object\n Dim md5 As New MD5CryptoServiceProvider\n 'Compute the hash value from the source\n Dim ByteHash() As Byte = md5.ComputeHash(Encoding.Default.GetBytes(SourceText))\n 'Instantiate a StringBuilder object\n Dim sb As New StringBuilder\n 'Repack binary hash as hex\n For c As Integer = 0 To ByteHash.Length - 1\n sb.AppendFormat(\"{0:x2}\", ByteHash(c))\n Next c\n 'Return the hex hash\n Return sb.ToString\nEnd Function", "language": "asp" } ] } [/block] ## C Sharp (.Net) [block:code] { "codes": [ { "code": "MD5 md5Hasher = MD5.Create();\n // Convert the input string to a byte array and compute the hash.\n byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));\n // Create a new Stringbuilder to collect the bytes\n // and create a string.\n StringBuilder sBuilder = new StringBuilder();\n // Loop through each byte of the hashed data\n // and format each one as a hexadecimal string.\n for (int i = 0; i < data.Length; i++)\n {\n sBuilder.Append(data[i].ToString(\"x2\"));\n }\n // Return the hexadecimal string.\n return sBuilder.ToString();", "language": "csharp" } ] } [/block]