Data::P...::Digest(3)

πŸ’… Data::Printer::Filter::Digest

okay so bestie, this page lives in the User Contributed Perl Documentation section of the manual, and it's about a lil plugin that makes your digests look gorgeous instead of like a sad wall of hex. It's Data::Printer::Filter::Digest β€” pretty-printing MD5, SHA and basically every other digest you'd ever touch. πŸŽ€


✨ NAME ✨

Data::Printer::Filter::Digest β€” pretty-printing MD5, SHA and many other digests πŸ’–


🌸 SYNOPSIS 🌸

so first things first, you drop this into your .dataprinter file:

filters = Digest

and if you wanna customize the look and feel (and like, why wouldn't you), there are these options too:

filter_digest.show_class_name = 0
filter_digest.show_reset      = 1

# you can even customize your themes:
colors.digest = #27ac3c

That's it! literally that's it. slay. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

This right here is a filter plugin for Data::Printer. What it does is it filters through a bunch of message digest objects and shows you their current value in hexadecimal format, as a string. no cap, that's the whole vibe check. πŸ’…

πŸŽ€ Parsed Modules πŸŽ€

Any module that inherits from Digest::base gets caught by this filter. These ones are the actively supported icons πŸ‘‘:

  • Digest::Adler32
  • Digest::MD2
  • Digest::MD4
  • Digest::MD5
  • Digest::SHA
  • Digest::SHA1
  • Digest::Whirlpool

If you've got suggestions for more modules or just, like, better output? please let us know, we're genuinely obsessed with feedback. 🫢

🌈 Extra Options 🌈

aside from the display color, there are a few other things you can customize through the filter_digest option key:

  • show_class_name β€” if you set this to true (which is the default, bestie), the class name gets displayed right next to the hexadecimal digest. very "who dis" energy.
  • show_reset β€” if this is set to true (also the default), the filter adds a [reset] tag after it dumps an empty digest object. the rationale is down below, keep reading πŸ‘€

πŸ’€ Note on dumping Digest::* objects πŸ’€

okay this is the important part so pay attention:

The digest operation is effectively a destructive, read-once operation. Once it's been performed, most Digest::* objects are automatically reset, and they can be used to calculate another digest value.

this behaviour β€” or, rather, forgetting about this behaviour β€” is a super common source of issues when you're working with Digests. like, extremely common. 😭

good news tho: this Data::Printer filter will not destroy your object. Instead, we do our work on a cloned version to display the hexdigest, leaving your original object completely untouched. your fave stays safe. 🧚

And as another debugging convenience for developers β€” since the empty object will still produce a digest even after being used β€” this filter adds a [reset] tag by default. That tag tells you the object is empty, sitting in a 'reset' state, i.e. its hexdigest is the same as the hexdigest of a brand-new, empty object of that same class. iconic honesty, honestly. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

  • Data::Printer

that's the whole page, bestie β€” no notes. this one's from perl v5.42.0, dated 2024-01-23, and yeah it's the Data::Printer::Filter::Digest page from the User Contributed Perl Documentation. go forth and pretty-print your digests πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from