User Tools

Site Tools


docs:api:hashstring

HashString

public static string HashString(string strToHash, byte[] secretKey)

Summary:

  • Computes an HMAC-SHA256 hash of the specified string using the provided secret key.
  • The input is normalized by trimming whitespace and converting to lower-case (invariant) before hashing.
  • The result is returned as a lower-case hexadecimal string.
string GenerateUsername()
{
    string username = "Player-" + Hashing.HashString(System.DateTime.Now.ToString(), Hashing.SecretKeyFromString("SecretKey"));
    username = username.Substring(0, 24); // cut off extra chars
    return username;
}
docs/api/hashstring.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki