Sitecore Commerce Connect employs a similar approach. From the Commerce Connect Integration Guide:
3.1.5 ID Mapping By design, the remote product repository is always regarded as the main repository, which by default owns the products.
That makes the ID of the products and artifacts in the external system
the primary key.
In Sitecore, the IDs of the corresponding items for
products and artifacts are generated by Connect instead of relying on
the default Sitecore implementation that automatically generates a new
GUID for each new item created.
By using a hash algorithm, it is
possible to generate a direct mapping between the IDs coming from the
external system and the item IDs in Sitecore. It has the following
- No need for mapping tables taking up space.
- It becomes very fast to get the ID of the corresponding item.
- There is no need for searching for the items in Sitecore if the external ID is provided.
The default implementation is based on the MD5 hash
algorithm and has the following format:
Item.ID = MD5.ComputeHash(Prefix + ExternalID);
So essentially; make a Sitecore ID based on prefix (which would be your entity type; "product", "category", "customer" and so on) and the foreign unique key of the entity. That should bring you to the same ID result every time.