The uniqueString function in ARM is a hash function that returns 13 chars. Executing the the function in the small script shown below richard
for example becomes b6oys6fwmheio
.
Does anyone know how this is implemented so one can reimplement it in code?
I'd be really handy to have when one creates and name things in the portal, and then just update it when deploying through ARM later.
ARM script for executing the function
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [],
"outputs": {
"uniqueName": {
"value": "[uniqueString('richard')]",
"type": "string"
}
}
}
Just using the standard hash algorithms and a very naive implementation doesn't really get you anywhere close either, as shown in this fiddle. So it'd be really nice to get some details of the implementation.
- Sha1 gave
lujs8awci6eim
- Sha256 gave
junhrxwwbjrth
- Sha512 gave
slqvqdqjz3xcx
A non-elegant solution (im not a PS dev :) ):