File::...acBlock(3pm)

πŸ“¦
version 0.906 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

File::KDBX::IO::HmacBlock β€” ok so it's an HMAC block stream IO handle, bestie πŸ’– it's a Perl thing, manual page name File::...acBlock(3pm), and it's lowkey one of the coolest little layered handles out there.

🌸 VERSION 🌸

version 0.906 β€” yes queen, we're on that version, no cap πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: when you write to a HMAC-block stream handle, it takes your data and glows it up into a whole series of blocks. Each block gets its own HMAC calculated, and that HMAC gets tucked right into the output. Data integrity AND authenticity, periodt. πŸ’…

When you read from a handle, every single block gets verified and authenticated as the blocks get disassembled back into a normal data stream. It's giving main character energy β€” the handle literally will not let a fake block slide.

This whole format is what helps ensure data integrity and authenticity of KDBX4 files. iykyk πŸ”₯

Every block is encoded like this, fr fr:

  • HMAC β€” 32 bytes, calculated over [block index (increments starting with 0), block size and data]
  • Block size β€” little-endian unsigned 32-bit (and it's counting only the data, okay? not the HMAC, not the size field itself)
  • Data β€” string of bytes
πŸŽ€ And the terminating block? It's an empty block, encoded exactly as usual, except the block size is 0 and there's just no data. That's how you know the stream is done. Goodbye, bestie 🌈

πŸ‘‘ ATTRIBUTES πŸ‘‘

πŸ’œ block_size

Desired block size when writing. The default is $File::KDBX::IO::HmacBlock::BLOCK_SIZE or 1,048,576 bytes. Cute, generous, one megabyte of chunkiness. ✨

πŸ”‘ key

The HMAC-SHA256 key for authenticating the data stream. This one is required, babe β€” no key, no authentication, no entry. πŸš«πŸ”‘


🌈 METHODS 🌈

🧚 new

$fh = File::KDBX::IO::HmacBlock->new(%attributes);
$fh = File::KDBX::IO::HmacBlock->new($fh, %attributes);

Construct a brand new HMAC-block stream IO handle. You can pass attributes on their own, or hand it an existing $fh first and then the attributes. Build your little stream wrapper and go off πŸ‘‘πŸ¦‹


πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/File-KDBX/issues> β€” the maintainer wants to hear from you, bestie, fr fr.

And when you submit a bug or a request, please include a test-file, or a patch to an existing test-file, that shows off the bug or the feature you're craving. Receipts! Evidence! We love a reproducible queen. πŸ™ˆπŸ’–


🫢 AUTHOR 🫢

Charles McGarvey <ccm@cpan.org> β€” iconic, legendary, wrote the whole thing. πŸ’œ


This software is copyright (c) 2022 by Charles McGarvey.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, that's the good open-source license energy. 🌸


⭐ And that's the whole page, girlies β€” this manual page came to you from perl v5.40.1, dated 2025-05-04, and it's on its way to being your fave IO handle. Byeeee πŸ’…βœ¨
πŸ“¦ where this page comes from