The recipe id (rid) has to be constructed always in the same way. CookML is using the ID from Ambrosia since 1997.
The RID contains a random number and a simple hash of the current username (called “Creator ID”) upon creation, which never changes and a date/time value, which can be updated if the recipe is changing. This allows to detect a never version of a recipe during import. The result are two 32 bit values written as “value 1,value 2” in CookML.

The Creator ID

The system user name (login name) is summed up in the following way:
For each character (in upper case): Creator-ID += Ascii(character) * character-position
Character-position is starting at 1
Only the lower 12 bits are used, over runs are ignored.

ordinal value87668285727378
 87132246340360438546+= 2149

The Serial ID

Starting with a random number which is increased by 1 (if multiple serial id’s are generated at once), any over runs are ignored.

Updating the RID

If an object (recipe) has a valid “RID” one updates only the date portion, the Serial-ID and the Creator-ID will never be changed. This is a change compared to the first version of cookML!


Value 1, Date

 year – 1980, 11 bitsmonth, 4 bitsdays, 5 bitshours, 5 bitsminutes, 6 bits
example: 12:09, 16-09-2006 = 27886345

Value 2, Creator ID and Serial ID

 Creator ID, 12 bitsSerial ID, 20 bits
Example: Creator ID = 2149, Serial ID = 783150