Crypt::...PEMD256(3)

πŸ’– Crypt::Digest::RIPEMD256(3) πŸ’–

okay so bestie, quick heads up: this whole page is from User Contributed Perl Documentation, and it's the manual for Crypt::Digest::RIPEMD256. The header up top gets squished into Crypt::...PEMD256(3) because terminals are dramatic and truncate things πŸ’… β€” the real name is the long one, promise.


✨ NAME ✨

Crypt::Digest::RIPEMD256 β€” hash function RIPEMD-256 [size: 256 bits]


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe, functional style first:

### Functional interface:
use Crypt::Digest::RIPEMD256 qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u
                             ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u );

# calculate digest from string/buffer
my $data = 'data string';
my $ripemd256_raw  = ripemd256($data);
my $ripemd256_hex  = ripemd256_hex($data);
my $ripemd256_b64  = ripemd256_b64($data);
my $ripemd256_b64u = ripemd256_b64u($data);
# or from file
my $ripemd256_file_raw  = ripemd256_file('filename.dat');
my $ripemd256_file_hex  = ripemd256_file_hex('filename.dat');
my $ripemd256_file_b64  = ripemd256_file_b64('filename.dat');
my $ripemd256_file_b64u = ripemd256_file_b64u('filename.dat');
# or from filehandle
my $filehandle = ...; # existing binary-mode filehandle
my $ripemd256_fh_raw  = ripemd256_file($filehandle);
my $ripemd256_fh_hex  = ripemd256_file_hex($filehandle);
my $ripemd256_fh_b64  = ripemd256_file_b64($filehandle);
my $ripemd256_fh_b64u = ripemd256_file_b64u($filehandle);

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

my $d = Crypt::Digest::RIPEMD256->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::RIPEMD256->new->addfile('filename.dat')->digest;

🌸 DESCRIPTION 🌸

it hands you an interface to the RIPEMD256 digest algorithm. that's the whole thing. iconic, honestly πŸŽ€


πŸ’œ EXPORT πŸ’œ

nothing is exported by default. like, at all. zero. πŸ™ˆ

but you can pick and choose your faves:

use Crypt::Digest::RIPEMD256 qw(ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u
                                ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u);

or just grab the whole squad at once:

use Crypt::Digest::RIPEMD256 ':all';

πŸ”₯ FUNCTIONS πŸ”₯

πŸ’« ripemd256

it joins all your arguments into one single string and returns its RIPEMD256 digest, encoded as a binary string. so raw. so real.

about those data arguments β€” for the functional helpers they get converted to byte strings using Perl's usual scalar stringification. defined scalars are accepted, including numbers and string-overloaded objects. undef is treated as an empty string and may emit Perl's usual "uninitialized value" warning. same rules apply to ripemd256_hex, ripemd256_b64, and ripemd256_b64u. iykyk 🫢

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

πŸ’« ripemd256_hex

joins all your arguments into one string and hands back the RIPEMD256 digest as a hexadecimal string. hex girl summer ✨

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

πŸ’« ripemd256_b64

joins all your arguments into one string, then returns the RIPEMD256 digest encoded as a Base64 string, with trailing '=' padding. the padding stays, she's not going anywhere πŸ’…

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

πŸ’« ripemd256_b64u

joins all your arguments into one string and returns the RIPEMD256 digest encoded as a Base64 URL-safe string (see RFC 4648 section 5). url-safe is her main character era πŸ‘‘

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

πŸ’« ripemd256_file

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

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

πŸ’« ripemd256_file_hex

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

my $ripemd256_hex = ripemd256_file_hex('filename.dat');
#or
my $filehandle = ...; # existing binary-mode filehandle
my $ripemd256_hex = ripemd256_file_hex($filehandle);
⚠️ note, bestie: the filehandle must be in binary mode before you pass it to addfile(). no cap, don't skip this step 😭

πŸ’« ripemd256_file_b64

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

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

πŸ’« ripemd256_file_b64u

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

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

🌈 METHODS 🌈

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

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

🧚 new

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

🧚 clone

$d->clone();

🧚 reset

$d->reset();

🧚 add

appends data to the message and returns the object itself (chaining, we love her 🫢).

each argument gets converted to bytes using Perl's usual scalar stringification. defined scalars β€” numbers and string-overloaded objects included β€” 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, periodt).

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

🧚 hashsize

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

🧚 digest

returns the binary digest (raw bytes). the first call finalizes the digest object β€” and after that, any later add(), addfile(), digest(), hexdigest(), b64digest(), or b64udigest() call will fail until you call reset(). she's done, she's closed the group chat πŸ’€

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

🧚 hexdigest

returns the digest encoded as a lowercase hexadecimal string. just 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 πŸ“ β€” brought to you by perl v5.42.0, dated 2026-05-11. go forth and hash responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from