sffuuid

sffuuid -a url -u www.google.com

    Generate UUID according to RFC4412 spec (http://tools.ietf.org/html/rfc4122)

    Input variables :
    (if nothing is specified, the default is the same as '-d')
        -3 : version 3 names - use MD5 and NOT SHA1 for the url (default for -u)
        -5 : version 5 names - use SHA1 and NOT MD5 for the url
        -d : Display the new UUID
        -D : Do NOT display the new UUID
        -f : log flag - a single lowercase letter for the log line  - default is 'd'
for '!d'
        -l : log uuid with this token name
            -l FOR_LUCY
        -L : force UUID lowercase
        -o : Output file name
            Store the UUID in a file - no display unless '-d' is also specified
        -u : Url
            Generate UUID from this url and display it/save in a file eg -u
www.fingerpost.co.uk
        -U : force UUID uppercase
        -x : Generate and test an UUID; can be used with -u url
        -v : Display version number and stops

-- Logging
    sffuuid -l hoho -f v
gives something like
    Mon Apr 22 14:08:54 sffuuid !v : hoho c8fe41b0-ab4d-11e2-8ddd-573646035cdc

-------------------------------------------------------
Version Control
;001e   21apr13 original ;e added fipuuid_create_sha1_from_name

--eodoc

  Linking on Windows
    1.needs WSOCK32.LIB

    2. Settings -> sffuuid -> all envs -> Link -> general 
    add   ssleay32.lib libeay32.lib to list of libraries

   3. Settings -> sffuuid -> all envs -> Link -> input
        addc:/openssl/lib to additional path

-------------------------------------------------------
adapted from ...
    Leach, et al.       Standards Track         [Page 21]
    RFC 4122          A UUID URN Namespace       July 2005

** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
** Digital Equipment Corporation, Maynard, Mass.
** Copyright (c) 1998 Microsoft.

-------------------------------------------------------
The variant covered by the UUID specification has five versions. For this
variant, the four bits of M indicates the UUID version (i.e., the hexadecimal M
will be either 1, 2, 3, 4, or 5).

Version 1 (MAC address)

Conceptually, the original (version 1) generation scheme for UUIDs was to
concatenate the UUID version with the MAC address of the computer that is
generating the UUID, and with the number of 100-nanosecond intervals since the
adoption of the Gregorian calendar in the West. This scheme has been criticized
in that it is not sufficiently "opaque"; it reveals both the identity of the
computer that generated the UUID and the time at which it did so. However, its
uniqueness is deterministic.

Version 2 (DCE Security)

Version 2 UUIDs are similar to Version 1 UUIDs, with the upper byte of the
clock sequence replaced by the identifier for a "local domain" (typically
either the "POSIX UID domain" or the "POSIX GID domain") and the first 4 bytes
of the timestamp replaced by the user's POSIX UID or GID (with the "local
domain" identifier indicating which it is).[4][5]

Version 3 (MD5 hash)

Version 3 UUIDs use a scheme deriving a UUID via MD5 from a URL, a fully
qualified domain name, an object identifier, a distinguished name (DN as used
in Lightweight Directory Access Protocol), or on names in unspecified
namespaces. Version 3 UUIDs have the form xxxxxxxx-xxxx-3xxx-yxxx-xxxxxxxxxxxx
where x is any hexadecimal digit and y is one of 8, 9, A, or B.
To determine the version 3 UUID of a given name, the UUID of the namespace
(e.g., 6ba7b810-9dad-11d1-80b4-00c04fd430c8 for a domain) is transformed to a
string of bytes corresponding to its hexadecimal digits, concatenated with the
input name, hashed with MD5 yielding 128 bits. Six bits are replaced by fixed
values, four of these bits indicate the version, 0011 for version 3. Finally,
the fixed hash is transformed back into the hexadecimal form with hyphens
separating the parts relevant in other UUID versions.

Version 4 (random)

Version 4 UUIDs use a scheme relying only on random numbers. This algorithm
sets the version number as well as two reserved bits. All other bits are set
using a random or pseudorandom data source. Version 4 UUIDs have the form
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is
one of 8, 9, a, or b (e.g., f47ac10b-58cc-4372-a567-0e02b2c3d479).

Version 5 (SHA-1 hash)

Version 5 UUIDs use a scheme with SHA-1 hashing; otherwise it is the same idea
as in version 3. RFC 4122 states that version 5 is preferred over version 3
name based UUIDs, as MD5's security has been compromised. Note that the 160 bit
SHA-1 hash is truncated to 128 bits to make the length work out. An erratum
addresses the example in appendix B of RFC 4122.
-------------------------------------------------------
TESTing ...
1. fip@muddy[185]: ./sffuuid -U -u www.example.com MUST give
5DF41881-3AED-3515-88A7-2F4A814CF09E

(copyright) 2017 and previous years FingerPost Ltd.