![]() ![]() The name is a string of arbitrary length. 1: UUID Namespace_RectalForeignExtractedObject = '8e884ace-bee4-11e4-8dfc-aa07a5b093db' It can be one of the pre-defined ones, or you can make up your own, e.g. The namespace is either a UUID in string representation or an identifier for internally pre-defined namespace UUIDs (currently known are "ns:DNS", "ns:URL", "ns:OID", and "ns:X500"). Now you can have calls: uuid = NameToUUID(Namespace_DNS, 'uuid = NameToUUID(Namespace_DNS, 'uuid = NameToUUID(Namespace_URL, '') įor version 3 and version 5 UUIDs the additional command line arguments namespace and name have to be given. (Note: the endian-ness of your system can affect indices of the above bytes) set high-nibble to 5 to indicate type 5 Copy first 16-bytes of the hash into our Uuid result Note: All code on stackoverflow is public domain - no attribution required.īyte hash = sha1(NamespaceUUID.ToBytes() + Name.ToBytes()) Now that you have a function that generates a so-called Name, you can have the function (in pseudo-code): UUID NameToUUID(UUID NamespaceUUID, String Name) The basic gist is to only take the first 128 bits, stuff a 5 in the type record, and then set the first two bits of the clock_seq_hi_and_reserved section to 1 and 0, respectively. StackOverflowUrlUUID = sha1(Namespace_URL + "") So, you could hash together: StackOverflowDnsUUID = sha1(Namespace_DNS + "") The UUID RFC pre-defines four namespaces for you: You prefix your string with a so-called namespace to prevent name conflicts. You're probably wondering what is it that I'm supposed to hash. ╰─low nibble is set to 5, to indicate type 5 ⭡ ⬑first two bits set to 1 and 0, respectively Type 6: unofficial idea for sequential UUIDsĮdit: Unofficial type 6 now has an official rfcĪn SHA1 hash outputs 160 bits (20 bytes) the result of the hash is converted into a UUID.Type 5: stuffs an SHA1 hash into 128 bits.Type 4: stuffs random data into 128 bits.Type 3: stuffs an MD5 hash into 128 bits.Type 1: stuffs MAC address+ datetime into 128 bits.Keeping any shell changes you make on one machine up to date on all the machines you code on is a nightmare without the right tooling.Type 3 and Type 5 UUIDs are just a technique of stuffing a hash into a UUID: Keeping developer experience consistent across machines ![]() Terminal prompts can be made git aware and use colour to indicate state so you don’t have to query git so often. You can replace tools like ls or cat with modern equivalents that support full colour, unicode icons, git state and more. But other developer tooling has advanced quite a bit since then. Many of the terminal tools that come with unix environments are functionally similar to how they were 20 years ago. ![]() The latest version lets you run a full Ubuntu instance that integrates seamlessly with the underlying windows instance.īy using WSL2 you can have a (mostly) identical developer experience jumping between MacOS and Windows. Windows “WSL” (Windows Subsystem for Linux) is a great tool for this you can use on Windows 10 and newer. I need to use the same tools and the same experience on both. I regularly code on both MacOS and Windows machines and I was always annoyed how different the default experiences are on each. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |