bin.sha256()
bin.sha256(data) → binary
Computes a SHA-256 hash — the standard way to derive an AES-256 key from a passphrase.
Useful for ensuring data integrity or for generating encryption keys from passphrases (Don't forget to salt your passphrases!)
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| data | string | yes | — | Data to hash, e.g. a passphrase. |
Returns
binary
32-byte digest, usable directly as an AES-256 key. Print with bin.toHex().
Example
let aesKey = sha256("flexscadaFlexsQ5!");
print("KEY: ", bin.toHex(aesKey));