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.

Σύνοψη#

my $text = $sha->getstate;

Τι επιστρέφεται#

A newline-terminated ASCII string.

Παραδείγματα#

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
## Resume on another machine:

my $text = $sha->getstate;
...
my $resumed = Digest::SHA->putstate($text);
$resumed->add($more_data);

Οριακές περιπτώσεις#

  • The text format is stable across Digest::SHA versions and endianness.

  • Called on a non-Digest::SHA object, returns undef.

Διαφορές από το upstream#

Fully compatible with upstream Digest::SHA 6.04.

Δείτε επίσης#

  • 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.