Disclaimer: As @Gary_Verhaegen pointed it out, users should consider contract IDs as opaque blocks.
In earlier SDKs, contract IDs were ledger-specific strings assigned before committing the transaction on the ledger but after DAML evaluation. Concretely, during evaluation of a DAML program, the engine was using special placeholders (called relative contract IDs) to identify contracts created within the transaction being built. Those relative contract IDs were later substituted with their final value by the ledger implementation.
The main drawback of this approach was that the contract IDs could not be ordered in a stable way. Because it was not known at interpretation time to which string a relative contract ID will be assigned, it was not possible to compare in a stable way a relative contract ID with another contract ID.
Staring from SDK 1.0.0, contract IDs are built from a cryptography hash (called a discriminator), computed during evaluation via a deterministic derivation scheme from an initial high-entropy number (called a submission seed) picked at submission time. The scheme leaves the ledger implementation free to suffix the contract ID as its convenience before committing the transaction. Without entering too much into the details, the derivation scheme guarantees that if the submission seed was never used before, (1) the discriminators of contract IDs created by the transaction are globally unique and (2) that no information about the transaction can be inferred from one of the discriminators given alone.
Assuming a participant is honest and chooses a proper high-entropy submission seed for each of its submissions, the uniqueness property we describe above ensures that only the discriminators, not the suffix are needed to order the contract IDs of created contracts w.r.t. other contract IDs. Upcoming SDKs will take advantage of this, and provide new builtins to order contract IDs and a new kind of ordered map where keys can contain arbitrary serializable values, including contract IDs.
Additionally, this new scheme makes it easier for a particular ledger implementation to limit information leakage through contract IDs. For instance, Sandbox, which chooses itself a fresh submission seed for each submission, uses the discriminator without a suffix, hence leaking (almost) no information through the contract IDs it generates. Though, exact security properties rely on a particular ledger implementation and how it uses contract ID suffixes.
More details about contract IDs can be found in the contract ID specification.