mardi 26 mars 2019

Generating same random unique number every time for a given number

We are having a set of groups and each group will have billions of records. Each group will uniquely identified by an id and each record in a group will be uniquely identified by an id. By combining these two ids(concat(groupid, recordid)) we can identify a record across the groups.

Now we are trying to change these id (concatenated) values, in our reports we don't want to share the direct ids with the customers that we are maintaining, rather we want to convert the ids to some other uniqueid and share that with the customers, so that it will be difficult for them to identify the group.

We have tried generating hash (hmac256 hashing) values for this, but that didn't work for our customer as it has increased their storage drastically. If the current id is of 20 digit length, and generating 45 characters hash is not working. So looking for a better option in generating 20 digit/string or at least 25 digit/string unique value which will not be having collisions.

Looking for some inputs on this.

We have tried generating hash (hmac256 hashing) values for this, but that didn't work for our customer as it has increased their storage drastically. If the current id is of 20 digit length, and generating 45 characters hash is not working.

Example: groupId=910612349078 recordId=6234091234

for the above two values, the unique id that system generates as of today will be looking like as below: uniqueId=9106123490786234091234 (concat(groupId, recordId))

The expected behavior for unique id will be some random/hash value: newUniqueId = some hash or some random number




Aucun commentaire:

Enregistrer un commentaire