The first possible way of achieving this that comes to my mind is by using hash codes.
Then for each and every file in your library a hash code could be calculated and stored in the database. (not in the file ;-)
But considering that most users will be modifying their music files once in a while, that will be quite problematic to maintain.
Perhaps you could use some existing tag such as 'date added'?
If you specify that time/date field into milliseconds (that can be done, can't it?) I am guessing you will have unique values for each file.
(assuming you are not using some quantum computer)
You could also create a custom tag for this specific purpose that you could write by e.g. using an AT&RT command such as $Now.
Not sure if/how that would work, it's just an idea that comes up.
Or a solution could be to use MusicBrainz' Picard and use the musicbrainz_recordingid tag.
But that will only work for songs that are in their database.