```{index} single: getstate_text; Digest::SHA function ``` ```{index} single: Digest::SHA::getstate_text; Perl function ``` # getstate_text Export a `Digest::SHA` object's state as a human-readable text string. Produces a multi-line plain-text dump of the current hashing state, including algorithm number, hash registers, pending block, and message length counters. The text form is portable across machines of different endianness and lends itself to inspection, diffing, and manual editing. Pair with `putstate` to reconstruct the state later. ## Synopsis ```perl my $text = $sha->getstate; ``` ## What you get back A newline-terminated ASCII string. ## Examples ```perl my $sha = Digest::SHA->new(256); $sha->add("hello"); print $sha->getstate; ## alg:256 ## H:... ## block:... ## blockcnt:40 ## lenhh:0 lenhl:0 lenlh:0 lenll:40 ``` ```perl ## Resume on another machine: my $text = $sha->getstate; ... my $resumed = Digest::SHA->putstate($text); $resumed->add($more_data); ``` ## Edge cases - The text format is stable across `Digest::SHA` versions and endianness. - Called on a non-`Digest::SHA` object, returns `undef`. ## Differences from upstream Fully compatible with upstream `Digest::SHA` {{ upstream.Digest_SHA }}. ## See also - `putstate` — inverse: parses text and constructs or updates an object. - `dump` — write the text state to a file or STDOUT. - `_getstate` — binary counterpart for same-machine use.