guid

Simple Generation of GUID in C

痞子三分冷 提交于 2019-11-29 09:36:04
I feel like GUID/UUID questions have been done to death here, but I can't seem to find quite what I'm looking for. I need a function that will generate V4 GUIDs in C, i.e. something that is essentially compatibile with Guid.NewGuid from C#. This has to work on Windows (XP, Server 2003/8, etc) and 3 different distros of Unix (AIX, Sun, and HP). I've seen some of the specification white papers, some that even have some sample implementations, but there always seems to be an issue with proper random numbers, or they only generate V1 or V3 UUIDs, etc. The wikipedia page for UUIDs pointed me at a

Persistent unique ID for Chrome tabs that lasts between browser sessions

…衆ロ難τιáo~ 提交于 2019-11-29 09:33:27
问题 I'm trying to ascertain some way to establish a unique ID for Chrome tabs that meets the following conditions: Uniquely identifies each tab Stays the same for a given tab between browser restarts (session-restored tabs) Stays the same if a tab is closed and then reopened with Undo Closed Tab (Ctrl+Shift+T) Stays distinct if a tab is duplicated I've done some rather aggressive research to find a comprehensive solution, but nothing seems to quite do the trick. Here are the methods I have tried,

default value of GUID in for a column in mysql

最后都变了- 提交于 2019-11-29 06:15:16
I want a column to default to a GUID, so if I am doing an insert and I don't explicitly set the value, I want it to default to a new GUID value. how can I do this? Being that UUID() isn't accepted as a DEFAULT constraint, you need to use a trigger. This one sets the value for the NEW_TABLE.uuid column: delimiter $$ CREATE DEFINER=`root`@`localhost` TRIGGER `example`.`newid` BEFORE INSERT ON `example`.`new_table` FOR EACH ROW BEGIN SET NEW.`uuid` = UUID(); END $$ pospi Previous answer is not quite right - you've got to be careful with triggers... they will actually overwrite any default value

Alternative to __uuidof in C

牧云@^-^@ 提交于 2019-11-29 06:11:48
I'm working with a C project that's using DirectX and I've run into a problem. Certain DX calls require a IID object, typically generated with __uuidof . One thing this is required for is creating a RenderTargetView. The DirectX samples/tutorials do this: ID3D11Texture2D* pBackBuffer = NULL; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); When I try to call __uuidof in my C code, I get an compiler error: Error 19 error C4233: nonstandard extension used : '__uuidof' keyword only supported in C++, not C . DirectX has a C interface, so I imagine there must

Performance value of COMB guids

假装没事ソ 提交于 2019-11-29 06:04:00
Jimmy Nilsson discusses his COMB guid concept here . This concept is popular in NHibernate, among other circles, for its supposed performance value over standard GUIDs which are typically far more random. However, in testing, this does not appear to be the case. Am I missing something? Test case: I have a table called temp (not a temp table, just a table named "temp") with 585,000 rows in it. I have a new table called Codes, and wish to copy all 585,000 code values from the temp table to the codes table. The test SQL I executed was: set statistics time on; truncate table codes; DBCC DBREINDEX

How can I generate a GUID in R?

流过昼夜 提交于 2019-11-29 05:33:46
How can I generate GUIDs and UUIDs in R? I would like to be able to generate GUIDs based on the hardware etc. of the machine running the rsession. As a fallback, however, I would be happy to create UUIDs that comply with rfc4122. Is there a package that can create GUIDs? Otherwise, does someone have some RFC4122 compatible UUID code lying about? The optimal choice for this now is the uuid package. It consists of one function ( UUIDgenerate ) that doesn't rely on R's internal random number generators and so doesn't suffer any consequences from using set.seed in a session as @thelatemail's

Create a cryptographically secure random GUID in .NET

六月ゝ 毕业季﹏ 提交于 2019-11-29 05:26:56
问题 I want to create a cryptographically secure GUID (v4) in .NET. .NET's Guid.NewGuid() function is not cryptographically secure, but .NET does provide the System.Security.Cryptography.RNGCryptoServiceProvider class. I would like to be able to pass a random number function as a delegate to Guid.NewGuid (or even pass some class that provides a generator interface) but it doesn't look as though that is possible with the default implementation. Can I create a cryptographically secure GUID by using

What is the probability of guessing (matching) a Guid?

♀尐吖头ヾ 提交于 2019-11-29 03:48:34
Just curious but what is the probability of matching a Guid? Say a Guid from SQL server: 5AC7E650-CFC3-4534-803C-E7E5BBE29B3D is it a factorial?: (36*32)! = (1152)! discuss =D jason It's not clear what you're asking. I see two ways to interpret your question. Given a GUID g , what is the probability of someone guessing it? Let's assume for simplicity that all 128 bits of a GUID are available. Then the probability of guessing g is 2^-128 . That's small. Let's get some intuition around that. Let's assume that our attacker can generate one billion GUIDs per second. To have a 50% chance of

.NET Core ASP.NET Core Basic 1-2 控制反转与依赖注入

穿精又带淫゛_ 提交于 2019-11-29 03:34:08
.NET Core ASP.NET Core Basic 1-2 本节内容为控制反转与依赖注入 简介 控制反转IOC 这个内容事实上在我们的C#高级篇就已经有所讲解,控制反转是一种设计模式,你可以这样理解控制反转,假设有一个人他有一部A品牌手机,他用手机进行听歌、打游戏,那么你可以创建一个手机类和一个人类 class APhone : IPhone { public string Owner{get;set;} public Phone(string own) { Owner = own; } void Play() { //省略 } void Music() { //省略 } } class Man { public string Name{get;set;} void Game() { var p = new APhone(Name); p.Play(); } } 事实上这段代码的耦合度是比较高的?它使用的是正转,也就是我需要什么东西的时候我就自己创建一个这个东西。为什么说他不好呢,如果有一天这个人决定再也不使用A品牌手机了,他决定以后只使用B品牌。那么也就意味着整个的Man类使用过APhone类的地方都需要更改。这是一个非常麻烦的事情,我们这个时候就需要运用我们的IOC控制反转了。我们将实例或者是需要使用的对象的创建交给你的调用者,自己只负责使用

Is a GUID a good key for (temporary) encryption?

我怕爱的太早我们不能终老 提交于 2019-11-29 03:22:38
I'm generating an encryption key to encrypt some sensitive data with the Rijndael (AES) encryption algoritm . I'm using a guid as key generator. Are these keys "strong" enough? Note: it is only sensitive for 20 minutes. mnemosyn No. The GUID keys can be predicted, at least those generated by .NET / WinAPI. Also keep in mind that the GUID does not even have a true 128bit randomness, because the version number is fixed. This gives you a very weak key in the first place. To make matters worse, several versions of the GUID algorithm suffer from predictability. The point is that GUIDs are not