I am writing a messaging program between several clients and a server.
I want to create a unique message identifier for each message. It must be generated by the server and returned to the client.
To send messages, I use a hash data structure, for example:
{ api => POST, username => sganesh, pass => "pass", message => "hai", time => "current_time", }
I want to create a unique identifier using this hash.
I tried several approaches, MD5 and freeze, but they give unreadable identifiers. I want some meaningful or readable unique identifiers.
I thought we could use microseconds to distinguish identifiers, but here the problem is with a few clients.
In any situation, identifiers must be unique.
Can someone help me solve this problem?
Thanks in advance.
source share