{
    "mode": "perldoc",
    "parameter": "Crypt::Mac::Poly1305",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Crypt%3A%3AMac%3A%3APoly1305/json",
    "generated": "2026-06-13T02:47:04Z",
    "synopsis": "### Functional interface:\nuse Crypt::Mac::Poly1305 qw( poly1305 poly1305hex );\n# calculate MAC from string/buffer\n$poly1305raw  = poly1305($key, 'data buffer');\n$poly1305hex  = poly1305hex($key, 'data buffer');\n$poly1305b64  = poly1305b64($key, 'data buffer');\n$poly1305b64u = poly1305b64u($key, 'data buffer');\n### OO interface:\nuse Crypt::Mac::Poly1305;\n$d = Crypt::Mac::Poly1305->new($key);\n$d->add('any data');\n$d->addfile('filename.dat');\n$d->addfile(*FILEHANDLE);\n$resultraw  = $d->mac;     # raw bytes\n$resulthex  = $d->hexmac;  # hexadecimal form\n$resultb64  = $d->b64mac;  # Base64 form\n$resultb64u = $d->b64umac; # Base64 URL Safe form",
    "sections": {
        "NAME": {
            "content": "Crypt::Mac::Poly1305 - Message authentication code Poly1305 (RFC 7539)\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "### Functional interface:\nuse Crypt::Mac::Poly1305 qw( poly1305 poly1305hex );\n\n# calculate MAC from string/buffer\n$poly1305raw  = poly1305($key, 'data buffer');\n$poly1305hex  = poly1305hex($key, 'data buffer');\n$poly1305b64  = poly1305b64($key, 'data buffer');\n$poly1305b64u = poly1305b64u($key, 'data buffer');\n\n### OO interface:\nuse Crypt::Mac::Poly1305;\n\n$d = Crypt::Mac::Poly1305->new($key);\n$d->add('any data');\n$d->addfile('filename.dat');\n$d->addfile(*FILEHANDLE);\n$resultraw  = $d->mac;     # raw bytes\n$resulthex  = $d->hexmac;  # hexadecimal form\n$resultb64  = $d->b64mac;  # Base64 form\n$resultb64u = $d->b64umac; # Base64 URL Safe form\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Provides an interface to the Poly1305 message authentication code (MAC) algorithm.\n",
            "subsections": []
        },
        "EXPORT": {
            "content": "Nothing is exported by default.\n\nYou can export selected functions:\n\nuse Crypt::Mac::Poly1305 qw(poly1305 poly1305hex );\n\nOr all of them at once:\n\nuse Crypt::Mac::Poly1305 ':all';\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "poly1305\nLogically joins all arguments into a single string, and returns its Poly1305 message\nauthentication code encoded as a binary string.\n\n$poly1305raw = poly1305($key, 'data buffer');\n#or\n$poly1305raw = poly1305($key, 'any data', 'more data', 'even more data');\n\npoly1305hex\nLogically joins all arguments into a single string, and returns its Poly1305 message\nauthentication code encoded as a hexadecimal string.\n\n$poly1305hex = poly1305hex($key, 'data buffer');\n#or\n$poly1305hex = poly1305hex($key, 'any data', 'more data', 'even more data');\n\npoly1305b64\nLogically joins all arguments into a single string, and returns its Poly1305 message\nauthentication code encoded as a Base64 string.\n\n$poly1305b64 = poly1305b64($key, 'data buffer');\n#or\n$poly1305b64 = poly1305b64($key, 'any data', 'more data', 'even more data');\n\npoly1305b64u\nLogically joins all arguments into a single string, and returns its Poly1305 message\nauthentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5).\n\n$poly1305b64url = poly1305b64u($key, 'data buffer');\n#or\n$poly1305b64url = poly1305b64u($key, 'any data', 'more data', 'even more data');\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new\n$d = Crypt::Mac::Poly1305->new($key);\n\nclone\n$d->clone();\n\nreset\n$d->reset();\n\nadd\n$d->add('any data');\n#or\n$d->add('any data', 'more data', 'even more data');\n\naddfile\n$d->addfile('filename.dat');\n#or\n$d->addfile(*FILEHANDLE);\n\nmac\n$resultraw = $d->mac();\n\nhexmac\n$resulthex = $d->hexmac();\n\nb64mac\n$resultb64 = $d->b64mac();\n\nb64umac\n$resultb64url = $d->b64umac();\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "*   CryptX\n\n*   <https://www.ietf.org/rfc/rfc7539.txt>\n",
            "subsections": []
        }
    },
    "summary": "Crypt::Mac::Poly1305 - Message authentication code Poly1305 (RFC 7539)",
    "flags": [],
    "examples": [],
    "see_also": []
}