Series, volume 7

ID and the universe

My name is Mirumi, and I run a blog called "Mirume" (https://mirumi.me). My main profession is software engineering, and I spend my days either programming or writing blog posts. For some time, I will be contributing articles on a wide range of topics, primarily focusing on IT technology. Please treat me kindly.

Suppose, one day suddenly, clones of all of you were created. Would those clones be considered the "same" as you? Even excluding ethical considerations, this is a very difficult question.

What is needed here is a definition of what constitutes sameness or difference, and the uniqueness that arises from it. This act of establishing uniqueness is often expressed by the word "identify," which itself is the origin of the term "ID" (identification).

In today's increasingly digital world, the concept of an ID has become very familiar. This time, we will focus on some interesting aspects of this topic and, in the end, explore a world with a grand sense of scale!

Examples of IDs and their properties

First, let's take a look at some examples of IDs that exist in various systems.

Flight number

Flight numbers like JL157 can also be considered a type of ID. Two notable characteristics are likely as follows.

The abbreviation and number of the airline are combined

Even with the same flight number, different dates may refer to different flights

Just as JL refers to JAL, it is common for abbreviations of proper nouns to be used as IDs. For example, airports also have unique airport codes such as NRT (Narita Airport), and stock market ticker symbols (MSFT: Microsoft) are another example.

The second point, "that the ID ceases to function as an identifier if the conditions change," is also extremely important. An ID is considered to be functioning correctly if its uniqueness is maintained within a certain scope; therefore, it is essential to always understand the scope to which that ID applies.

ISBN (International Standard Book Number)

It is an international standard for identifying books. While the concept of a globally assigned number isn't particularly new, it's noteworthy that the last digit of the 13-digit numerical code represents a check digit.

This value is automatically calculated based on the other 12 digits, which makes it effective against input errors and number forgery. This technology is also used in things like My Number (Japanese individual identification number) and credit card numbers.

Furthermore, the 12-digit number itself is not randomly assigned; it is represented by a hierarchical structure based on groupings such as country or publisher. This is a common pattern for IDs, and similarly, My Number also uses a similar system.

IP address

An IP address can be considered a good example, both positive and negative, of an identifier. Initially, it was thought that assigning unique numbers to all devices connected to the internet would be sufficient, but this is no longer the case in modern times, leading to what is known as the "IP address exhaustion problem."

Initially, the system used IPv4, which allowed for approximately 4.3 billion different addresses. Currently, a new standard called IPv6 provides an enormous number of address patterns, specifically 2^128 (2 to the power of 128).

The nature of IDs in computer systems

An ID can be considered the most fundamental type of digital data. This is because it contains information that is extremely important for identifying what specific data it represents. Conversely, without an ID, it is impossible to definitively pinpoint a particular piece of data. Even if you narrow down the criteria as much as possible, such as "Japanese male, living in Tokyo, left-handed, 31 years old...", there is always a possibility that "there might be other people who match the same criteria."

If we consider this matter further, certain essential requirements for an ID become apparent.

・ It is designed to ensure that there is absolutely no overlap within a certain range

That's all there is to it. If the ID is unique and doesn't overlap with IDs assigned to other data, then it functions perfectly as an identifier. Let's take a look at how this is implemented in computer systems, and see some examples.

Sequential numbering

This is the simplest yet most powerful method. As long as the rule "always increase the numerical value with each addition of data" is followed, it will never result in duplicates for an indefinite period.

However, with a little more thought, one can quickly identify several challenges, such as the following.

・Assigning numbers sequentially means that there needs to be something that keeps track of "what number was assigned last" (※1)

If the number of digits in the ID changes, it cannot be used with systems that have problems. (You might think about filling it with zeros, but then you would need to determine the expected number of digits beforehand, which presents its own challenges)

Despite this, it is still widely used in modern applications. A well-known example of its use is Niconico Video. The IDs of old videos that are said to be "the oldest on Niconico" are formatted as "sm9" or "sm13," and this can also be confirmed from the video URLs (※2).

Not only on video-sharing platforms like Nico Nico Douga, but also at the end of web page URLs, an ID is usually attached to indicate the data. This is because without it, it would be impossible to specify which page to display. In other words, the URL itself can be considered an ID, and its core represents the ID of the main data (in this case, a video).

In many cases, you can use the "sequential numbering function" that is standardly included in database systems for storing data. However, there are some potential pitfalls, such as what happens to the numbers when data is deleted, so caution is necessary.

※2 The oldest video

Timestamp

The idea is to use a timestamp, that is, a string representing the date and time, directly as an ID. This can be seen as an extension of the concept of sequential numbering. The rule "always use the current time" automatically ensures that "the time will always be later than the previously used time."

However, for example, if data is identified using seconds as the unit, duplicate IDs can occur if multiple pieces of data are registered within the same second. This type of problem still occurs today; recently, in 2023, a system for issuing family registry certificates in a certain municipality experienced a malfunction that resulted in the issuance of someone else's family registry certificate (※3).

Furthermore, a common concept known as Unix time, which represents timestamps as simple numerical values, is sometimes used as an ID (※4). Also, there was a more advanced ID generation system called Snowflake, developed by the former Twitter company (※5).

※3 This news item became quite a topic of discussion in the IT industry, with rumors circulating that "timestamps measured in seconds were being used as data IDs." However, the actual content reported in the news only stated that "at two convenience stores, when two residents submitted applications at almost the same time (within one second), subsequent processing would overwrite earlier processing." Reference: https://www.itmedia.co.jp/news/articles/2305/10/news114.html

*4. UNIX time refers to the number of seconds elapsed since January 1, 1970, at 00:00:00 Coordinated Universal Time (UTC), represented as an integer. The current UNIX timestamp when I am writing this article is "1731231406," and any subsequent UNIX timestamps obtained will always be greater than this value. A typical example of a service that uses UNIX time is the URL for each message link in Slack.

※5 In Snowflake, in addition to the timestamp, IDs of the machines performing the generation process are also included. This allows for the rapid generation of unique IDs even in large-scale distributed systems. As an example mentioned in note 3, this ensures uniqueness even when processing is performed simultaneously at numerous convenience stores. You can actually see this at the end of the URL for each tweet (post).

UUID

Is there a system that can easily generate unique IDs? Actually, yes, such a system exists.

A UUID (Universally Unique Identifier) is essentially a mechanism that continuously outputs a single value randomly selected from an extremely large number of possible patterns. Because the underlying process is very simple, you can generally generate IDs on any computer.

A UUID, for example, might look like "fe275d49-c6ed-4adf-94d8-a8c7a895cbf5." It consists only of letters from a to f and numbers, and is joined by hyphens at specified intervals (※6). In fact, you probably encounter strings in this format countless times every day; many services use UUIDs directly for things like order IDs, product IDs, and the URLs of those pages. It's arguably the most popular type of ID.

Now, what's most concerning here is whether there is truly no overlap, but let's explore that and then embark on a journey into the universe.

※6 Within UUIDs, there are many different standards that define "versions," each with its own mechanism. However, when we refer to a UUID in modern usage, it generally refers to version 4. The UUIDs mentioned in this text are also of version 4 and were generated on a website accessible over the internet. Reference: https://www.uuidgenerator.net

The world of extremely large numbers (googology)

The combination of characters in a UUID represents approximately 2^128 patterns, which is roughly equivalent to 340,282,366,920,938,463,463,374,607,431,768,211,456 possibilities (the same number of patterns as IPv6). While UUIDs are commonly represented as strings composed of alphanumeric characters and hyphens, their underlying nature is simply a very large number (a 128-bit number, hence the 2^128 patterns). Let's look at some examples to help you grasp the magnitude of this number.

Commonly encountered issues include

Approximately 450 sextillion times the number of grains of sand on Earth (estimated at about 10^18)

Even if it continues to generate 1 trillion (10^12) IDs per second, it would take approximately 10^18 years to exhaust all possible patterns, which is about 72 million times the age of the universe

These are examples of such numbers. They represent an incredibly large scale, and it becomes clear that there is virtually no need to worry about ID duplication within a single system. Even if duplication were to occur somewhere, the probability of it happening within the same system would be extremely close to zero (※7).

UUIDs are simply a simple ID generation system, and cryptographic security is not particularly required. SHA-256 (※8), which is a representative example of "cryptographic hash functions" that has appeared many times in this series, literally produces 256 bits, or 2^256 patterns. While its primary purpose is related to security, from the perspective of generating unique IDs, it is similar to what we have discussed in this article (because of the hashing mechanism, it guarantees that different content data will always generate a different ID).

Let's also examine the magnitude of this number, 2^256. The number of patterns is..

115792089237316195423570985008687907853269984665640564039457584007913129639936

As expected, it's 10 to the power of 78 (which is a number with 78 digits). This scale is close to the estimated number of atoms in the observable universe (approximately 10 to the power of 80), and frankly, it's beyond my comprehension.

If I try to explain it further with an analogy

・For the next 5 billion years, until the sun reaches the end of its life

・ 10 billion people..

There is an activity that consumes trillions of numbers every nanosecond

・If this activity were to be carried out on all the stars in this galaxy, which our solar system belongs to (approximately 200 billion),

The number of digits consumed would be a 59-digit number calculated as: 5 billion years multiplied by 100 billion people, multiplied by 100 million nanoseconds, multiplied by 60 seconds, multiplied by 60 minutes, multiplied by 24 hours, multiplied by 365 days, multiplied by 1 trillion digits, multiplied by 200 billion digits (representing stars)

Even with such intense consumption, only 1 hundred billionth of the total amount will be used up 50 billion years from now (when the Sun becomes a red giant and the solar system collapses)

It becomes something like that (Note 9). You can really feel the vastness of space! It's a scale that truly deserves to be called astronomical.

While there is no precise definition, numbers of this magnitude and larger are referred to as "googolplex" numbers. These numbers are so large that the concept of units becomes meaningless. Whether the unit is meters or light-years, the difference becomes insignificant compared to the sheer size of the number. It's truly astonishing; it almost makes one dizzy.

The idea that something is safe because it's "practically impossible" is a common one in the IT world, but it can be difficult to trust such claims without understanding the underlying details. However, as in this case, by bravely attempting to understand even a small part of those massive numbers, one can realize how unfounded these concerns truly are. This journey through the universe surrounding IDs seems likely to continue for quite some time, in various ways.

※7 Even if there is a UUID conflict within the same system, in most cases, it does not cause problems. The scenarios where you want to assign an ID usually involve inserting new data into a database, but when data IDs are duplicated, the insertion will fail, and you will be given opportunities to retry appropriately.

※8 For information on hash functions, please refer to Vol. 2 (No. 143, Autumn issue of '23) and Vol. 4 (No. 145, Spring issue of '24), available at this link and this link, respectively.

※9 This is a slightly modified version of content originally written on a personal blog, which I have quoted and adapted for my own technical blog. The original page, including the source, is available here: https://mirumi.tech/secret-manage-pub-repo

(Written by Miru)

(Featured in the New Year issue of Up&Coming '25)



Previous page
    
Index
    
Next page

Up&Coming

LOADING