# Method Nettle.Hash()->hash()

Method hash

  ``string(8bit)` hash(`string(8bit)` `data`)`

Description

  Works as a (faster) shortcut for `State()->update(data)->digest()`, where State is the hash state class corresponding to this Hash.

See also

  State()->update() and State()->digest().

Method hash

  ``string(8bit)` hash(`Stdio.File` `file`, `void`|`int` `bytes`)`

Description

  Works as a (faster) shortcut for `State()->update(Stdio.read_file(file))->digest()`, where State is the hash state class corresponding to this Hash.

Parameter `bytes`

  The number of bytes of the file object file that should be hashed. Negative numbers are ignored and the whole file is hashed.

See also

  Stdio.File, State()->update() and State()->digest().