unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jesper Harder <harder@myrealbox.com>
Subject: Re: UUIDGEN in lisp
Date: Mon, 16 Feb 2004 18:10:04 +0100	[thread overview]
Message-ID: <m3k72nq7bn.fsf@defun.localdomain> (raw)
In-Reply-To: mailman.2471.1076940207.928.help-gnu-emacs@gnu.org

Brad Collins <brad@studiojungle.net> writes:

> I've looked this up in the elisp manual but don't really understand
> what is going on.  I noticed in the original script that the third
> field always would begin with the number four.

Yes,  it should be 4.  A random UUID is 128 bits, but only 122 bits
are random.  It's generated according to this algorithm[1]:

,----
|   The version 4 UUID is meant for generating UUIDs from truly-random or
|   pseudo-random numbers.
| 
|   The algorithm is as follows:
| 
|   .  Set the 2 most significant bits (bits numbered 6 and 7) of the
|      clock_seq_hi_and_reserved to 0 and 1, respectively.
| 
|   .  Set the 4 most significant bits (bits numbered 12 to 15 inclusive)
|      of the time_hi_and_version field to the 4-bit version number
|      corresponding to the UUID version being created, as shown in the
|      table above.  [0 1 0 0]
| 
|   .  Set all the other bits to randomly (or pseudo-randomly) chosen
|      values.
`----

The six non-random bits identify which kind of UUID it is, time-based,
random-based etc.

> What does `logior' and `logand' actually do in the script

They set the non-random bits.

> and what does the string #B01000000 mean?

It is read syntax for writing numbers in base 2. `#B01000000' is the
same as the number 64.

[1] http://hegel.ittc.ukans.edu/topics/internet/internet-drafts/draft-l/draft-leach-uuids-guids-01.txt

  parent reply	other threads:[~2004-02-16 17:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2374.1076727586.928.help-gnu-emacs@gnu.org>
2004-02-14  4:05 ` UUIDGEN in lisp Jesper Harder
2004-02-14 18:23   ` Brad Collins
     [not found]   ` <mailman.2398.1076783242.928.help-gnu-emacs@gnu.org>
2004-02-15  0:27     ` Jesper Harder
2004-02-15  4:16       ` Brad Collins
2004-02-15 16:05         ` Brad Collins
     [not found]       ` <mailman.2412.1076818749.928.help-gnu-emacs@gnu.org>
2004-02-15 20:47         ` Jesper Harder
2004-02-16 10:04           ` Eli Zaretskii
2004-02-16 13:47           ` Brad Collins
     [not found]           ` <mailman.2461.1076925909.928.help-gnu-emacs@gnu.org>
2004-02-16 16:30             ` Jesper Harder
2004-02-16 19:48               ` Eli Zaretskii
     [not found]               ` <mailman.2509.1076960950.928.help-gnu-emacs@gnu.org>
2004-02-16 21:05                 ` Jesper Harder
2004-02-17  6:46                   ` Eli Zaretskii
     [not found]                   ` <mailman.2546.1077000306.928.help-gnu-emacs@gnu.org>
2004-02-17 18:45                     ` Jesper Harder
2004-02-17 20:08                       ` Eli Zaretskii
     [not found]                       ` <mailman.2586.1077048551.928.help-gnu-emacs@gnu.org>
2004-02-17 21:21                         ` Jesper Harder
2004-02-18  6:34                           ` Eli Zaretskii
2004-02-19 16:57                         ` Stefan Monnier
     [not found]           ` <mailman.2471.1076940207.928.help-gnu-emacs@gnu.org>
2004-02-16 17:10             ` Jesper Harder [this message]
2004-02-14 18:54 ` Kai Grossjohann
2004-02-15  2:37   ` Felix
2004-02-14  2:57 Brad Collins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k72nq7bn.fsf@defun.localdomain \
    --to=harder@myrealbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).