This was created as a bit of fun/curiosity to reverse engineer the uniqueString function used in the Azure ARM template language. The function is used to generate a deterministic hash string based on the inputs provided. This is commonly used to generate unique resource names in Azure.
To use this project you can follow the below steps:
- Clone the repository
- Run the following command to build the project:
go build
- Then Run the following to execute it:
> go-azure-uniquestring hello world
a7wkljktk6wne
The uniqueString function takes a number of arguments and does the following:
- Concatenates all the arguments together with a hyphen separator
- Uses a seemingly custom implementation of Murmurhash64B to generate a hash of the concatenated string
- Encodes the resulting hash as a base32 string
So for example the values "hello" and "world" would go through the following steps:
- Concatenated: "hello-world"
- Hashed: 571013382255652050
- Encoded: "a7wkljktk6wne"
- Azure.Deployments.Expression - Holds a C# reference/implementation to the uniqueString function
- Austin Appleby - The original author of the MurmurHash algorithm