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

Method hash

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

Description

  Shortcut for hashing some data.

Parameter `data`

  String to hash.

Parameter `file`

  Stdio.File object to read some data to hash from.

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.

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

See also

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