Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6364613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:11:13+00:00 2026-05-25T00:11:13+00:00

This article explains how Guids are generated. My question is that is there any

  • 0

This article explains how Guids are generated.

My question is that is there any way to find out which machine in my web farm generated this Guid and when?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:11:14+00:00Added an answer on May 25, 2026 at 12:11 am

    Neil Fenwick is correct. However we can use the structure to our advantage.

    Version 4 (.Net)

    Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the version number as well as two reserved bits. All other bits are set using a random or pseudorandom data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B. e.g. f47ac10b-58cc-4372-a567-0e02b2c3d479.

    Use the Version Field

    We are free to change the first nibble of byte 8; so if you have less than 17 machines you can identify them by altering the GUIDs created on each one.

    static Guid NewSystemGuid(int machine)
    {
        if (machine < 0 | machine > 0xF)
            throw new ArgumentOutOfRangeException("machine");
        var g = Guid.NewGuid();
        var arr = g.ToByteArray();
        arr[7] = (byte)((machine << 4) | (arr[7] & 0xF));
        return new Guid(arr);
    }
    
    static int ExtractMachine(Guid guid)
    {
        var arr = guid.ToByteArray();
        return (arr[7] >> 4) & 0xF;
    }
    

    Use the Version Field and ‘y’

    I am not sure if changing Y will alter the uniqueness of the GUID, so your mileage may vary. If you have less than 17 machines stick with the first solution.

    static Guid NewSystemGuid(int machine)
    {
        if (machine < 0 | machine > 0xFF)
            throw new ArgumentOutOfRangeException("machine");
    
        var m1 = machine & 0xF;
        var m2 = (machine >> 4) & 0xF;
    
        var g = Guid.NewGuid();
        var arr = g.ToByteArray();
        arr[7] = (byte)((m1 << 4) | (arr[7] & 0xF));
        arr[8] = (byte)((m2 << 4) | (arr[8] & 0xF));
        return new Guid(arr);
    }
    
    static int ExtractMachine(Guid guid)
    {
        var arr = guid.ToByteArray();
        return 
            ((arr[7] >> 4) & 0xF) |
            (((arr[8] >> 4) & 0xF) << 4);
    }
    

    Use the Version and ‘y’ (Redux)

    You can still retain the value in ‘y’ by limiting the amount of machines to 63 (using the last 2 bits to represent the 4 possible values of ‘y’):

    static Guid NewSystemGuid(int machine)
    {
        if (machine < 0 | machine > 0x3F)
            throw new ArgumentOutOfRangeException("machine");
    
        var m1 = machine & 0xF;
        var m2 = (machine >> 4) & 0xF;
    
        var g = Guid.NewGuid();
        var arr = g.ToByteArray();
        arr[7] = (byte)((m1 << 4) | (arr[7] & 0xF));
    
        var y = (arr[8] >> 4) & 0xF;
        switch (y)
        {
            case 0x8:
                arr[8] = (byte)((m2 << 4) | (arr[8] & 0xF));
                break;
            case 0x9:
                arr[8] = (byte)(((m2 | 0x8) << 4) | (arr[8] & 0xF));
                break;
            case 0xA:
                arr[8] = (byte)(((m2 | 0x4) << 4) | (arr[8] & 0xF));
                break;
            case 0xB:
                arr[8] = (byte)(((m2 | 0xC) << 4) | (arr[8] & 0xF));
                break;
            default:
                throw new Exception();
        }
        return new Guid(arr);
    }
    
    static int ExtractMachine(Guid guid)
    {
        var arr = guid.ToByteArray();
        return 
            ((arr[7] >> 4) & 0xF) |
            (((arr[8] >> 4) & 0x3) << 4);
    }
    

    Use Version 1 GUIDs

    You could also use version 1 GUIDs, as it’s still possible to generate them:

    class SequentialGuid
    {
        [DllImport("rpcrt4.dll", SetLastError = true)]
        static extern int UuidCreateSequential(out Guid guid); 
    
        public static Guid NewGuid()
        {
            Guid guid;
            UuidCreateSequential(out guid);
            return guid;
        }
    
        public static byte[] ExtractMacAddress(Guid guid)
        {
            var arr = guid.ToByteArray();
            // Require version 1.
            if (((arr[7] >> 4) & 0xF) != 1)
                throw new ArgumentOutOfRangeException("guid", "GUID is required to be a sequential (version 1) GUID.");
    
            var macLong = BitConverter.ToInt64(arr, arr.Length - 8);
            macLong = IPAddress.NetworkToHostOrder(macLong);
            arr = BitConverter.GetBytes(macLong);
            Array.Resize(ref arr, 6);
    
            return arr;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't find any article which explains this. Someone does know ? thanks. Problem
I've found this MSDN article that explains how to monitor processes and services with
This article states that If your site is run on a shared Web server,
The Java Virtual Machine supports several garbage collection strategies. This article explains them. Now
My question is with reference to this question which explains how virtual functions work
I recently came across this article which explains how to use HTML5 tags in
I read an article which explains what prototype chain is. It says that if
This article describes a way, in C#, to allow the addition of arbitrary value
I was reading this article about Double-Checked locking and out of the main topic
I read in this article that a company has created a software capable of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.