add extra comment

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2023-09-25 15:58:51 +02:00
parent eac230f93e
commit 2dc22bc8e7
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D

View File

@ -72,6 +72,11 @@ func ComputeSecureUniqueDeterministicNameFromData(fullName string, maxNameLength
return "", err
}
// Although fullName is already a DNS subdomain, we can't just cut it
// at N characters and expect another DNS subdomain. That's because
// we might cut it right after a ".", which would give an invalid DNS
// subdomain (eg. test.-<hash>). So we make sure the last character
// is an alpha-numeric character.
prefix := DNSSafeShortenToNCharacters(fullName, maxNameLength-hashLength-1)
hashResult := hash.Sum(nil)