sha256 static method
SHA-256 of value, as 64 hex characters.
For a long random secret that you store and look up, like an API key or an access token: keep only this hash in the database, and find the row by the hash of what the client sends. It is fast and the same for the same input, so a unique index works on it.
Never use it for passwords. A password is short and can be guessed, so use make (bcrypt) for those.
String stored = Hash.sha256(token);
Implementation
static String sha256(String value) {
return crypto.sha256.convert(utf8.encode(value)).toString();
}