The UniqueID number factory-programmed to the system ROM of STM32 promises to be a valuable way to distinguish individual devices, e.g. when addressing them on multi-drop communication bus. However, the uniqueness is bound to a relatively long 96-bit (12-byte) number, while for most practical uses a shorter, 24- or 32-bit "serial"/unique number is required.
Users are thus tempted to somehow reduce the UniqueID, while still maintain its uniqueness. One attempted method is to generate a shorter "hash" of the UniqueID, using whatever method available, CRC being a popular option. This, of course, does not provide unique-ness by any means, as no hash does, although the resulting output appears to be tantalizingly "random".
Other users noticed, that the UniqueID contains structured data - and indeed, some RM even explain that the UniqueID consists from the X/Y position of given die on the wafer, of the wafer number within lot, and the manufacturing lot marking. Clearly, this results in much less information than 96 bits. The X/Y position and wafer number appears to be stored as ASCII numbers. However, this is not documented by ST, and also there is no description on what are the expected ranges of these numbers, nor the structure of the lot identifier. So, at the end of the day, the whole 96 bits have to be treated as a black-box, providing unique identification only if taken as it is.
So, there's no good way to reduce the UniqueID length. If a shorter serial/unique number is required for whatever purpose, users have to generate them themselves by the usual methods, at the moment when the STM32 is being programmed at device manufacturing. Some STM32 families provide a OTP (One-Time Programmable) section of memory, which is a good place to store this kind of numbers/information.
One notable exception, where the 96-bit UniqueID can be used as it is, is in the role of Serial Number Descriptor of USB Device. This is transmitted and interpreted as a string, so its particular length is not critical.