Function deltachat::tools::create_id

source ยท
pub(crate) fn create_id() -> String
Expand description

Generate an unique ID.

The generated ID should be short but unique:

  • short, because it used in Message-ID and Chat-Group-ID headers and in QR codes
  • unique as two IDs generated on two devices should not be the same

IDs generated by this function have 144 bits of entropy and are returned as 24 Base64 characters, each containing 6 bits of entropy. 144 is chosen because it is sufficiently secure (larger than AES-128 keys used for message encryption) and divides both by 8 (byte size) and 6 (number of bits in a single Base64 character).