Skip to content

UUID version b, created by bzhn. Currently is for generation UUIDs for files. This version of UUID stores timestamp as regular UUID v1. Also UUID of the b version says you about approximate size of file, hash sum and modulo of the file size, so you can check it before calculating the sum of big files for verification.

License

bzhn/buid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buid

UUID version b, created by bzhn. Currently is for creating UUID for files. This version of UUID stores timestamp in the same way as regular UUID v1. Also UUID with the b version says you about approximate size of file, hash sum and modulo of the file size, so you can check it before calculating the sum of big files for verification.

How this works?

Generate UUID version b

Compile the project from this repository:

go build -o buid .

Then run this binary, providing a path to the file you want to identify and the hash to use (from 1 to 3).

./buid.exe -path="./filename" -hash=2

You will get the output like this: f3fb9025-5468-b1ed-f660-dafd80307446

Decode UUID version b

Also, you can get some data from UUID about the file, without any tools.

Let's look at the previously generated UUID of the ./filename: f3fb9025-5468-b1ed-f660-dafd80307446

Time of UUID generation

You can find out when the UUID was generated by pasting it into https://www.uuidtools.com/decode and replacing b (the UUID version) with 1 and f (the UUID variant) with a (so the UUID will look like UUID version 1):

f3fb9025-5468-b1ed-f660-dafd80307446 f3fb9025-5468-11ed-a660-dafd80307446

The time was determined successfully: 2022-10-25 13:28:46.503530.1 UTC

Type of hash sum that was used to generate identifier and random

There are three hash sums that can be used in the generated UUID version b:

  • sha256sum
  • sha512sum
  • xxhash64

Let's look at the part of the UUID that is before the last dash: f660 f describes the variation of the UUID.

The second number is 6, which in binary representation is 0101 Snippet from the source code:

SHA256HASHnum = 0 // 00xx
SHA512HASHnum = 4 // 01xx
XXH64HASHnum  = 8 // 10xx

First two numbers of the binary representation can say you about hashing algorithm that was used. 01xx stands for SHA-512 hash sum. And the last two bits were randomly generated. The last two random bits are to decrease chances of collission. Later they can be used for different purposes.

To summarize: we use second charachter from the left of the part before the last to determine hashing algorithm that have been used to generate UUID. If the charachter, converted to binary looks like 00xx, 01xx, 10xx, then the hash that have been used is SHA256, SHA512, XXHASH64 respectively.

Approximate size of the file

Let's look at the part of the UUID that is before the last dash: f660

Third character from the right is 6. So the file size is bigger than $10^6$ KB and less than $10^7$ KB.

Hash sum of the file

From the previous part we already know that UUID was generated using sha512 hashing algorithm. The part after the last dash (dafd80307446) describes first 12 characters of the hash of the file.

The full file SHA-512 hash is dafd803074467112b6af89ad39f79d800db3ffe4ed43cc946b1c827c8b829202f1440a64ce6551edd467c55593f01579950483b62d1be6349c3070388770d57c

About

UUID version b, created by bzhn. Currently is for generation UUIDs for files. This version of UUID stores timestamp as regular UUID v1. Also UUID of the b version says you about approximate size of file, hash sum and modulo of the file size, so you can check it before calculating the sum of big files for verification.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages