Skip to content

Error in message hashing #72

@andrey-prokopyev

Description

@andrey-prokopyev

Message label must be used in hash calculation

public string CalculateHash(IMessage message)
{
    var buffer = this.payloadConverter.Value.FromObject(message.Payload);
    var hash = this.sha256Managed.ComputeHash(buffer);
    return BitConverter.ToString(hash);
}

otherwise hashes of messages with same payload but different labels would be the same. For example, two next messages are different, but have same hash:

command.users.contacts.get
{
    Id : 10
}

command.messages.incoming.get
{
    Id : 10
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions