Crypt::...PEMD160(3)

πŸ’… Crypt::...PEMD160(3)

okay so bestie, this is the Crypt::...PEMD160(3) page from User Contributed Perl Documentation β€” also known in the wild as Crypt::Digest::RIPEMD160 β€” and we're gonna get you cozy with it. it's giving crypto-girlie energy fr fr πŸŽ€


✨ NAME ✨

Crypt::Digest::RIPEMD160 β€” Hash function RIPEMD-160 [size: 160 bits] πŸ¦‹

like literally the whole point, no cap.


🌸 SYNOPSIS 🌸

so here's the vibe. functional interface first:

### Functional interface:
use Crypt::Digest::RIPEMD160 qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u
                             ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u );

# calculate digest from string/buffer
my $data = 'data string';
my $ripemd160_raw  = ripemd160($data);
my $ripemd160_hex  = ripemd160_hex($data);
my $ripemd160_b64  = ripemd160_b64($data);
my $ripemd160_b64u = ripemd160_b64u($data);
# or from file
my $ripemd160_file_raw  = ripemd160_file('filename.dat');
my $ripemd160_file_hex  = ripemd160_file_hex('filename.dat');
my $ripemd160_file_b64  = ripemd160_file_b64('filename.dat');
my $ripemd160_file_b64u = ripemd160_file_b64u('filename.dat');
# or from filehandle
my $filehandle = ...; # existing binary-mode filehandle
my $ripemd160_fh_raw  = ripemd160_file($filehandle);
my $ripemd160_fh_hex  = ripemd160_file_hex($filehandle);
my $ripemd160_fh_b64  = ripemd160_file_b64($filehandle);
my $ripemd160_fh_b64u = ripemd160_file_b64u($filehandle);

### OO interface:
use Crypt::Digest::RIPEMD160;

my $d = Crypt::Digest::RIPEMD160->new;
$d->add('any data');
my $result_raw  = $d->digest;     # raw bytes
my $result_hex  = $d->hexdigest;  # hexadecimal form
my $result_b64  = $d->b64digest;  # Base64 form
my $result_b64u = $d->b64udigest; # Base64 URL-safe form

# or hash a file instead
my $file_result_raw = Crypt::Digest::RIPEMD160->new->addfile('filename.dat')->digest;

two whole ways to do the thing, pick your fighter πŸ‘‘βœ¨


πŸ¦‹ DESCRIPTION πŸ¦‹

it gives you an interface to the RIPEMD160 digest algorithm. that's literally it, that's the whole description β€” short and iconic πŸ’…


πŸŽ€ EXPORT πŸŽ€

bestie. listen. nothing is exported by default. you have to actually ask, okay? πŸ™ˆ

you can hand-pick which functions you want:

use Crypt::Digest::RIPEMD160 qw(ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u
                                    ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u);

or go feral and take all of them at once:

use Crypt::Digest::RIPEMD160 ':all';

main character energy honestly 🌈


πŸ”₯ FUNCTIONS πŸ”₯

πŸ’– ripemd160

joins all the arguments into one single string and returns its RIPEMD160 digest, encoded as a binary string (raw bytes, the spicy unreadable kind 😭).

about the data arguments for the functional helpers: they get converted to byte strings using Perl's usual scalar stringification. defined scalars β€” including numbers and string-overloaded objects β€” are accepted, so you're fine. undef is treated as an empty string and may emit Perl's usual "uninitialized value" warning (you know the one, the little scream in your logs πŸ’€). and just so you know, the exact same rules apply to ripemd160_hex, ripemd160_b64, and ripemd160_b64u.

 my $ripemd160_raw = ripemd160('data string');
 #or
 my $ripemd160_raw = ripemd160('any data', 'more data', 'even more data');

πŸ’– ripemd160_hex

joins all arguments into a single string and returns its RIPEMD160 digest encoded as a hexadecimal string ✨

 my $ripemd160_hex = ripemd160_hex('data string');
 #or
 my $ripemd160_hex = ripemd160_hex('any data', 'more data', 'even more data');

πŸ’– ripemd160_b64

joins all arguments into a single string and returns its RIPEMD160 digest encoded as a Base64 string, with trailing '=' padding β€” yes the padding is staying, it's part of the fit πŸŽ€

 my $ripemd160_b64 = ripemd160_b64('data string');
 #or
 my $ripemd160_b64 = ripemd160_b64('any data', 'more data', 'even more data');

πŸ’– ripemd160_b64u

joins all arguments into a single string and returns its RIPEMD160 digest encoded as a Base64 URL-safe string (see RFC 4648 section 5). URL-safe, so it behaves in links, unlike some people πŸ¦‹

 my $ripemd160_b64url = ripemd160_b64u('data string');
 #or
 my $ripemd160_b64url = ripemd160_b64u('any data', 'more data', 'even more data');

πŸ’– ripemd160_file

reads a file β€” given by a filename or a filehandle β€” and returns its RIPEMD160 digest encoded as a binary string.

 my $ripemd160_raw = ripemd160_file('filename.dat');
 #or
 my $filehandle = ...; # existing binary-mode filehandle
 my $ripemd160_raw = ripemd160_file($filehandle);

πŸ’– ripemd160_file_hex

reads a file given by a filename or filehandle and returns its RIPEMD160 digest encoded as a hexadecimal string.

 my $ripemd160_hex = ripemd160_file_hex('filename.dat');
 #or
 my $filehandle = ...; # existing binary-mode filehandle
 my $ripemd160_hex = ripemd160_file_hex($filehandle);
⚠️ Note: the filehandle must be in binary mode before you pass it to addfile(). don't skip this step bestie, it's not a vibe πŸ’€

πŸ’– ripemd160_file_b64

reads a file given by a filename or filehandle and returns its RIPEMD160 digest encoded as a Base64 string, with trailing '=' padding.

 my $ripemd160_b64 = ripemd160_file_b64('filename.dat');
 #or
 my $filehandle = ...; # existing binary-mode filehandle
 my $ripemd160_b64 = ripemd160_file_b64($filehandle);

πŸ’– ripemd160_file_b64u

reads a file given by a filename or filehandle and returns its RIPEMD160 digest encoded as a Base64 URL-safe string (see RFC 4648 section 5).

 my $ripemd160_b64url = ripemd160_file_b64u('filename.dat');
 #or
 my $filehandle = ...; # existing binary-mode filehandle
 my $ripemd160_b64url = ripemd160_file_b64u($filehandle);

πŸ‘‘ METHODS πŸ‘‘

the OO interface provides the same set of functions as Crypt::Digest. unless noted otherwise, just assume $d is an existing digest object you made via new, like so:

 my $d = Crypt::Digest::RIPEMD160->new();

🌟 new

 my $d = Crypt::Digest::RIPEMD160->new();

fresh digest object, brand new, baby's first hash 🫢

🌟 clone

 $d->clone();

🌟 reset

 $d->reset();

🌟 add

appends data to the message. returns the object itself, so you can chain β€” obsessed with a fluent API honestly πŸ”₯

each argument is converted to bytes using Perl's usual scalar stringification. defined scalars β€” including numbers and string-overloaded objects β€” are accepted. undef is treated as an empty string and may emit Perl's usual "uninitialized value" warning πŸ™ˆ

 $d->add('any data');
 #or
 $d->add('any data', 'more data', 'even more data');

🌟 addfile

reads the file content and appends it to the message. returns the object itself (chaining again, slay ✨).

 $d->addfile('filename.dat');
 #or
 my $filehandle = ...; # existing binary-mode filehandle
 $d->addfile($filehandle);

🌟 hashsize

 $d->hashsize;
 #or
 Crypt::Digest::RIPEMD160->hashsize();
 #or
 Crypt::Digest::RIPEMD160::hashsize();

three whole ways to ask the same question, iykyk πŸ’…

🌟 digest

returns the binary digest (raw bytes). the first call finalizes the digest object β€” and here's the important part, bestie: any later add(), addfile(), digest(), hexdigest(), b64digest(), or b64udigest() call will fail until you call reset(). it's done, it's closed, the door is shut 😭

 my $result_raw = $d->digest();

🌟 hexdigest

returns the digest encoded as a lowercase hexadecimal string. like digest(), the first call finalizes the digest object.

 my $result_hex = $d->hexdigest();

🌟 b64digest

returns the digest encoded as a Base64 string with trailing "=" padding. like digest(), the first call finalizes the digest object.

 my $result_b64 = $d->b64digest();

🌟 b64udigest

returns the digest encoded as a Base64 URL-safe string (no trailing "="). like digest(), the first call finalizes the digest object.

 my $result_b64url = $d->b64udigest();

🌈 SEE ALSO 🌈


and that's the whole page, bestie, you ate that πŸ“ go forth and hash responsibly.

🧚 cute little sign-off: this was perl v5.42.0, dated 2026-05-11, and yes, it's still Crypt::...PEMD160(3) at the end of it all πŸ’œ
πŸ“¦ where this page comes from