Crypt::Mac::F9 - Message authentication code F9
| Use Case | Command | Description |
|---|---|---|
| Compute binary MAC | f9($cipher, $key, $data) | Returns raw binary F9 MAC |
| Compute hex MAC | f9_hex($cipher, $key, $data) | Returns hex-encoded F9 MAC |
| Compute Base64 MAC | f9_b64($cipher, $key, $data) | Returns Base64-encoded MAC |
| Compute URL-safe Base64 MAC | f9_b64u($cipher, $key, $data) | Returns Base64 URL-safe MAC |
| OO: new object | Crypt::Mac::F9->new($cipher, $key) | Creates F9 MAC object |
| OO: add data | $d->add($data) | Adds data incrementally |
| OO: add file | $d->addfile('path') | Adds contents of a file |
| OO: finalize (raw) | $d->mac | Returns binary MAC |
| OO: finalize (hex) | $d->hexmac | Returns hex MAC |
| OO: finalize (Base64) | $d->b64mac | Returns Base64 MAC |
| OO: finalize (Base64 URL) | $d->b64umac | Returns URL-safe Base64 MAC |
use Crypt::Mac::F9 qw( f9 f9_hex );
# calculate MAC from string/buffer
$f9_raw = f9($cipher_name, $key, 'data buffer');
$f9_hex = f9_hex($cipher_name, $key, 'data buffer');
$f9_b64 = f9_b64($cipher_name, $key, 'data buffer');
$f9_b64u = f9_b64u($cipher_name, $key, 'data buffer');
use Crypt::Mac::F9;
$d = Crypt::Mac::F9->new($cipher_name, $key);
$d->add('any data');
$d->addfile('filename.dat');
$d->addfile(*FILEHANDLE);
$result_raw = $d->mac; # raw bytes
$result_hex = $d->hexmac; # hexadecimal form
$result_b64 = $d->b64mac; # Base64 form
$result_b64u = $d->b64umac; # Base64 URL Safe form
Provides an interface to the F9 message authentication code (MAC) algorithm.
Nothing is exported by default.
You can export selected functions:
use Crypt::Mac::F9 qw(f9 f9_hex );
Or all of them at once:
use Crypt::Mac::F9 ':all';
Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a binary string.
$f9_raw = f9($cipher_name, $key, 'data buffer');
#or
$f9_raw = f9($cipher_name, $key, 'any data', 'more data', 'even more data');
Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a hexadecimal string.
$f9_hex = f9_hex($cipher_name, $key, 'data buffer');
#or
$f9_hex = f9_hex($cipher_name, $key, 'any data', 'more data', 'even more data');
Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 string.
$f9_b64 = f9_b64($cipher_name, $key, 'data buffer');
#or
$f9_b64 = f9_b64($cipher_name, $key, 'any data', 'more data', 'even more data');
Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5).
$f9_b64url = f9_b64u($cipher_name, $key, 'data buffer');
#or
$f9_b64url = f9_b64u($cipher_name, $key, 'any data', 'more data', 'even more data');
$d = Crypt::Mac::F9->new($cipher_name, $key);
$d->clone();
$d->reset();
$d->add('any data');
#or
$d->add('any data', 'more data', 'even more data');
$d->addfile('filename.dat');
#or
$d->addfile(*FILEHANDLE);
$result_raw = $d->mac();
$result_hex = $d->hexmac();
$result_b64 = $d->b64mac();
$result_b64url = $d->b64umac();
Generated by phpman v4.9.22-1-g1b0fcb4 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-05 02:22 @216.73.216.52
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-pro / taotoken.net / www.chedong.com - original format