C ++ Linux GCC应用程序中的GUID [英] GUIDs in a C++ Linux GCC app

查看:140
本文介绍了C ++ Linux GCC应用程序中的GUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多运行这个Linux应用程序的服务器。我希望他们能够生成一个碰撞概率较低的GUID。我确信我可以从/ dev / urandom中提取128个字节,这可能会很好,但是有一个简单的&简单的方法来生成一个更相当于Win32的GUID?特别是,考虑到空间(以及MAC地址),时间和随机性?我不想为此取消对话框,我只想要 CreateGuid ()

I've got a bunch of servers running this Linux app. I'd like for them to be able to generate a GUID with a low probability of collision. I'm sure I could just pull 128 bytes out of /dev/urandom and that would probably be fine, but is there a simple & easy way to generate a GUID that is more equivalent to the Win32 one? Specifically, one that takes into account space (well, MAC address), time, and randomness? I don't want to call off the box for it, I just want something like CreateGuid()

推荐答案

互联网草案详细描述了一种类型的UUID,当我需要一个UUID实现并且不能链接到一个现有的图书馆的建筑原因。

This Internet Draft describes one type of UUID in great details and I have used a similar approach with great success when I needed a UUID implementation and could not link to an existing library for architectural reasons.

文章提供了一个很好的概述。

This article provides a good overview.

这篇关于C ++ Linux GCC应用程序中的GUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆