Hash and Crypto Functions
Hash and crypto functions are helpful to generate UUIDs in version 4 and version 5. There are more functions to compute different hashing methods such as SHA1, MD5, and so on, which have applicable use cases in the field of cryptography.
These functions can also be used to encrypt a file using different methods based on specific requirements. The examples used in the section will be available with the filename 9. hash-and-crypto-functions.txt
in the GitHub link provided at the start of this chapter.
The uuid() Function
The uuid()
function generates a unique UUID identifier. The version 4 UUID generated by this function is random in nature and cannot be duplicated easily. This function will generate a new output every time it is tried out.
Here is an example:
$ uuid()
> "9e3eaa9e-5304-4077-7a9a-4f267e9319aa"
The uuidv5() Function
This function generates a version 5 UUID based on the name
and namespace
values. This is different...