We have 2 tables which are joined by customer id (key field). This is a valid 11-proof number. We have a requirement to mask customer id in both tables ensuring consistency and 11-proof check.

Is there any function which generates 11-proof numbers and also helps us manage the relational integrity. If not, can we create a seed by generating valid 11-proof numbers and create a mapping between original customer id and generated 11-proof id such that the data is masked consistently based on this seed.

Hi Abhinav,

Well, it depends..... what algorithm are you using to calculate the checksum??

We have generated a checksum digit that follows this algorithm :

static int calcMidCheckDigit(char *sMid, char *sCkDig)

{

int rc = EXIT_SUCCESS;

int dig[11];

int i;

int ckNum;

float f;

if (strlen(sMid) >= 10)

{

/* pop string into one-digit integers */

for (i = 0; i < 11; i++)

{

dig[i] = sMid[i] - '0';

}

/* multiply digits by positional factors */

ckNum = (dig[0] * 5)

+ (dig[1] * 4)

+ (dig[2] * 3)

+ (dig[3] * 2)

+ (dig[4] * 7)

+ (dig[5] * 6)

+ (dig[6] * 5)

+ (dig[7] * 4)

+ (dig[8] * 3)

+ (dig[9] * 2);

/* divide by 11, round to 2nd decimal place */

f = (ckNum / 11.0) + 0.005;

/* shift left 2 places to drop after 2nd decimal... */

ckNum = f * 100.;

/* retain only 2 least-significant digits */

ckNum = ckNum % 100;

/* ... then shift right 2 places to get a fraction again */

f = ckNum / 100.;

/* multiply and prepare to round */

f = (11. * f) + 0.5;

/* get integer part only */

ckNum = f;

ckNum *= 10;

/* and finally... */

ckNum = 110 - ckNum;

/* now get the 10's digit */

ckNum /= 10;

ckNum %= 10;

/* convert to string */

sprintf(sCkDig, "%d", ckNum);

}

else

{

rc = EXIT_FAILURE;

}

return (rc);

}

If original value is null, we return null.

If original value is less than 10 digits in length, we return the same value back.

We need a minimum of 10 digits to generate the check-digit. So, anything greater than 10 digits is sliced to get the first 10 digits and then the algorithm is applied.

This new function is called RIDCHECKDIGIT and is in version FDM 4.6.328.0 or higher. Please check with Support if a link is needed to the latest.

If you find that your Client's checksum value is not calculated as above, then FDM supports custom masking using external JARs. Please review the video received from engineering to our communities.

https://communities.ca.com/videos/5394

Things to consider:-

Use core masking functions first and this should be final option.

Please let us know if this helps.

Cheers!

Les.