Generate the User Ids
Generate the User ID First things you’ll need are the UID ingredients. The Internal User ID (for each of your users), App ID, and Security Key.
internalUserID = User123
appID = 1sJ57hgit
securityKey = 838ab4b72d221a585af8b4be7a540234
Generate an md5 hash of the combined string using your programming language’s md5 function (using Python 3, it is in a library called hashlib). Then concatenate the first 10 characters of the md5 hash. Make sure the Checksum is lowercase.
Generate an md5 hash of the combined string
Concatenate the first 10 characters using hexdigest(:10)
concat_input = internalUserID + appID + securityKey
checksum = hashlib.md5(concat_input).hexdigest()[:10]
Combine them all into one to create the PL UID.
PL_UID = internalUserID + “-” + appID + “-” + checkSum
Repeat this process for each of your users to create their User ID.
Examples
Here are examples of how to do this process using 3 different programming languages.
Python
#This Script Produces a PL User ID using Python
import hashlib
import sys
endUserId = "User123" #insert internal user ID here
applicationKey = "54dbf08d625158c6d7b055928d6ac0cc" #insert application key here
applicationId = "9145" #insert App ID here.
checkSum = hashlib.md5(endUserId + applicationId + applicationKey)
userId = endUserId + "-" + applicationId + "-" + checkSum.hexdigest()[:10]
print(userId)
Ruby
require 'digest'
end_user_id = 'test_user'
publisher_id = '1'
security_key = '00000000000000000000000000000000'
hash = Digest::MD5.hexdigest(end_user_id + publisher_id + publisher_security_key)
user_id = "#{end_user_id}-#{publisher_id}-#{hash[0..9]}”
C#
System.Security.Cryptography;
public class Program
{
public static void Main()
{
var endUserID = "User123"; //assuming a member id for their user to be 3. Make sure to change it for every user
var publisherId = "9165";
var securityKey = "34101a01e1f305b39d16283d5dd05194";
var hash = CalculateMD5Hash(endUserID + publisherId + securityKey);
var userId = endUserID + "-" + publisherId + "-" + hash.Substring(0, 10).ToLower();
var iFrameURL = "https://www.rapidoreach.com/offerwall/?userId=" + userId + "&dob=03-03-1979&sex=1"; //make sure to append the correct dob and sex for every user
Console.WriteLine("Generated user id is :{0}", userId);
Console.WriteLine("Generated iFrameURL is :{0}", iFrameURL);
}
public static string CalculateMD5Hash(string input)
{
// step 1, calculate MD5 hash from input
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
}
No Comments