Code Search for Developers
 
 
  

guid.py from The Nebula Device at Krugle


Show guid.py syntax highlighted

#--------------------------------------------------------------------------
# GUID Generator
#
# (c) 2005 Vadim Macagon
#
# Contents are licensed under the Nebula license.
#--------------------------------------------------------------------------

import random, md5, socket, time

def GenerateGUID():
    t = long(time.time() * 1000)
    r = long(random.random() * 100000000000000000L)
    ip = ''
    try:
        ip = socket.gethostbyname(socket.gethostname())
    except:
        # if we can't get a network address, just imagine one
        ip = str(random.random() * 100000000000000000L)
    data = str(t) + ' ' + str(r) + ' ' + ip
    guidStr = md5.new(data).hexdigest()
    # now that we have the GUID format it to look like
    # XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
    return '%s-%s-%s-%s-%s' % (guidStr[:8], guidStr[8:12], guidStr[12:16],
                               guidStr[16:20], guidStr[20:])




See more files for this project here

The Nebula Device

Realtime 3D game/visualization engine, written in C++, scriptable through Tcl/Tk, Python and Lua. Supports D3D and OpenGL for rendering, runs under Linux and Windows.

Project homepage: http://sourceforge.net/projects/nebuladevice
Programming language(s): C,C++,Python
License: other

  Plex/
    Actions.py
    DFA.py
    Errors.py
    Lexicons.py
    Machines.py
    README
    Regexps.py
    Scanners.py
    TODO
    Timing.py
    Traditional.py
    Transitions.py
    __init__.py
    test_tm.py
  docs/
    layout/
      inset-h.jpg
      nav-end.gif
      nav-start.jpg
      nebuladevice2.gif
      tnd.css
      top-back.gif
      top-image.jpg
    screens/
      classbuilderconfirm.png
      classbuildertab.png
      workspacestab.png
    Manual.html
  generators/
    __init__.py
    doxygen.py
    factory.py
    makefile.py
    vstudio7.py
    vstudio71.py
    vstudio8.py
  gui/
    xrc/
      format_dlg.xrc
      renderpath.xrc
    __init__.py
    buildlog.py
    classbuilderpanel.py
    cmddatapanels.py
    cmdeditorpanel.py
    cmdparser.py
    doxygengeneratorsettings.py
    externaltaskdialog.py
    main.py
    workspacespanel.py
    xrcguiutils.py
  __init__.py
  bldscanner.py
  buildconfig.py
  buildsys.py
  bundle.py
  config.mak
  externaltask.py
  guid.py
  module.py
  pykillwinproc.pyd
  target.py
  workspace.py