On Wed, Aug 12, 2015 at 2:09 AM, Sean P. DeNigris <s...@clipperadams.com> wrote:
> Searching the archives, I found an interesting comment [1]:
>   "I think the UUIDGenerator in the image produces UUIDs which are good
> enough for MC. " - Levente Uzonyi
>
> I am pretty well confused by UUIDs in general (they seem magical) and
> Pharo's implementation. The use case I have in mind is a file library which
> imports files into a single folder, but changes their names to something
> guaranteed to be unique so that they don't overwrite each other. Would UUIDs
> work in that case? Would the image ones be "good enough"? Are
> primitive-generated UUIDs guaranteed to always be unique if, say, I move the
> image to another OS and continue generating them with another VM? Thanks!
>
> [1] http://forum.world.st/UUID-and-Cog-tp2955687p2957172.html
>

Unless your requirements *specifically* need identical files to be
maintained as duplicates, I would strongly consider using something
content based like MD5 or SHA.  Guaranteed to remain the same between
OS and good-enough uniqueness. Its also compatible with external
tools. Pharo seems to have an implementation.
https://en.wikipedia.org/wiki/Secure_Hash_Algorithm

Depending on the breadth of your audience, you may want to base it off
HashFunction and allow user configuration of algorithm.  Selectivity
between security and performance can be useful.

btw1, git uses SHA-1...
https://git-scm.com/book/en/v2/Git-Internals-Git-Objects

btw2, UUID actually uses MD5 and SHA, but on a smaller input than full
file contents.  Cross platform may(?) have to contend with there being
several revisions of UUID (unless handling all past versions is
implicit in all implementations), particularly by external tools.
https://en.wikipedia.org/wiki/Universally_unique_identifier

btw3, I love turtles all the way down, but given that crypto
algorithms are CPU bound and Pharo will be single-CPU for some time,
it might be pragmatic to have the crypto primitives to thread onto a
separate CPU, and maybe take advantage of hardware acceleration.  Call
it SHAxExternal...
https://software.intel.com/en-us/articles/intel-sha-extensions

cheers -ben

Reply via email to