← All docs

hash_init()

Opens an incremental hashing context, returning a HashContext object. Provided by the compiler-injected hash prelude in compiled code; the eval interpreter still returns a resource.

hash_init()

function hash_init(string $algo): HashContext

Opens an incremental hashing context, returning a HashContext object. Provided by the compiler-injected hash prelude in compiled code; the eval interpreter still returns a resource.

Parameters:

  • $algo (string)

Returns: HashContext

Availability

  • Compiled (AOT): supported through the compiler-injected hash prelude.
  • AOT signature compatibility: prelude-signature-subset — compiled code accepts the signature shown above; eval may expose the broader canonical signature.
  • Effective eval signature: hash_init(string $algo, int $flags = 0, string $key = "").
  • eval() (magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/string/hash_init.rs).

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how hash_init is implemented in the compiler, see the internals page.