Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

guid

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

guid

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

NAME

Guid - Produce GUID/UUID from Ruby

SYNOPSIS

require 'guid'

generate a GUID

g = Guid.new puts g # 79328095-636a-6cc5-2bbb-606df7228a01 puts g.to_s # 79328095-636a-6cc5-2bbb-606df7228a01 puts g.hexdigest # 79328095636a6cc52bbb606df7228a01 puts g.raw.inspect # "\227#\010Y6\246\306\\262\273\006\326\177"\250\020" puts g.raw.length # 16

generate another GUID, should be different everytime

g2 = Guid.new puts g == g2 # false (it better be! :-)

convert a hexstring into Guid object

g3 = Guid.from_s("79328095-636a-6cc5-2bbb-606df7228a01") puts g3 # 79328095-636a-6cc5-2bbb-606df7228a01 puts g == g3 # true

convert a raw 16-byte string into Guid object

g4 = Guid.from_raw("\227#\010Y6\246\306\\262\273\006\326\177"\250\020") puts g4 # 79328095-636a-6cc5-2bbb-606df7228a01 puts g == g4 # true

DESCRIPTION

This library can produce GUID/UUID on Windows (except first release of Win95 and older version) and on Unix using random number. I have only tested this library under Win2k and Redhat 7.3; please report if you fail to use it on other platforms. On Windows, it uses CryptGenRandom(). On Unix, it uses /dev/urandom (and if fail, try to use /dev/random). No other external program or library is needed.

The latest version of this library can be obtained from:

http://rubyforge.org/projects/uuid/

To install:

% ruby install.rb config
% ruby install.rb setup
# ruby install.rb install

SEE ALSO

  • FAQ

CREDITS

  • Thanks to Stephen Veit for pointing out how to use Win32API.

LICENSE

Copyright (c) 2004 David Garamond .

This library is free software; you can redistribute it and/or modify it under the same terms as Ruby itself.

FAQs

Package last updated on 25 Jul 2009

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc