Skip to content

CID generation is wrong #302

@RichardTea

Description

@RichardTea

CIDs are being generated by the following code:

CID CID::CreateCid()
{
    QUuid uuid = QUuid::createUuid();
    QByteArray bits = uuid.toByteArray();

    CID result;
    memcpy(result.m_cid, bits.data(), CIDBYTES);
    return result;
}

This is simply incorrect. QUuid::toByteArray() returns a string representation of the UUID, eg:
{d6baa5c0-c5e9-48eb-bba3-f64a86f29ef8}
Fortunately the string representation is always larger than the 16 bytes, and is fairly unique.

The correct call is QUuid::toRfc4122() to get the big-endian representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions