Skip to content

JasonWhall/go-azure-uniquestring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

go-azure-uniquestring

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.

Usage

To use this project you can follow the below steps:

  1. Clone the repository
  2. Run the following command to build the project:
go build
  1. Then Run the following to execute it:
> go-azure-uniquestring hello world
a7wkljktk6wne

How it works

The uniqueString function takes a number of arguments and does the following:

  1. Concatenates all the arguments together with a hyphen separator
  2. Uses a seemingly custom implementation of Murmurhash64B to generate a hash of the concatenated string
  3. Encodes the resulting hash as a base32 string

So for example the values "hello" and "world" would go through the following steps:

  1. Concatenated: "hello-world"
  2. Hashed: 571013382255652050
  3. Encoded: "a7wkljktk6wne"

Sources

About

ARM uniqueString function in go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages