{"id":13420557,"url":"https://github.com/varnish/libvmod-digest","last_synced_at":"2025-04-25T23:31:12.650Z","repository":{"id":1687985,"uuid":"2415940","full_name":"varnish/libvmod-digest","owner":"varnish","description":"Digest and HMAC vmod","archived":false,"fork":false,"pushed_at":"2023-08-17T07:12:09.000Z","size":107,"stargazers_count":50,"open_issues_count":2,"forks_count":27,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-07-31T22:55:41.228Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varnish.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-09-19T14:50:08.000Z","updated_at":"2023-09-04T11:21:29.000Z","dependencies_parsed_at":"2023-10-22T02:31:30.193Z","dependency_job_id":null,"html_url":"https://github.com/varnish/libvmod-digest","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnish%2Flibvmod-digest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnish%2Flibvmod-digest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnish%2Flibvmod-digest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varnish%2Flibvmod-digest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varnish","download_url":"https://codeload.github.com/varnish/libvmod-digest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250912660,"owners_count":21506865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:36.214Z","updated_at":"2025-04-25T23:31:12.419Z","avatar_url":"https://github.com/varnish.png","language":"C","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"===========\nvmod_digest\n===========\n\n---------------------\nVarnish Digest Module\n---------------------\n\n:Manual section: 3\n:Author: Kristian Lyngstøl\n:Date: 2016-03-16\n:Version: 1.0.3\n\nSYNOPSIS\n========\n\n::\n\n        import digest;\n\n        digest.hmac_md5(\u003ckey\u003e,\u003cmessage\u003e);\n        digest.hmac_sha1(\u003ckey\u003e, \u003cmessage\u003e);\n        digest.hmac_sha256(\u003ckey\u003e, \u003cmessage));\n\n        digest.base64(\u003cstring\u003e);\n        digest.base64url(\u003cstring\u003e);\n        digest.base64url_nopad(\u003cstring\u003e);\n        digest.base64_hex(\u003cstring\u003e);\n        digest.base64url_hex(\u003cstring\u003e);\n        digest.base64url_nopad_hex(\u003cstring\u003e);\n        digest.base64_decode(\u003cstring\u003e);\n        digest.base64url_decode(\u003cstring\u003e);\n        digest.base64url_nopad_decode(\u003cstring\u003e);\n\n        digest.version()\n\n        digest.hash_sha1(\u003cstring\u003e);\n        digest.hash_sha224(\u003cstring\u003e);\n        digest.hash_sha256(\u003cstring\u003e);\n        digest.hash_sha384(\u003cstring\u003e);\n        digest.hash_sha512(\u003cstring\u003e);\n        digest.hash_gost(\u003cstring\u003e);\n        digest.hash_md2(\u003cstring\u003e);\n        digest.hash_md4(\u003cstring\u003e);\n        digest.hash_md5(\u003cstring\u003e);\n        digest.hash_crc32(\u003cstring\u003e);\n        digest.hash_crc32b(\u003cstring\u003e);\n        digest.hash_adler32(\u003cstring\u003e);\n        digest.hash_haval128(\u003cstring\u003e);\n        digest.hash_haval160(\u003cstring\u003e);\n        digest.hash_haval192(\u003cstring\u003e);\n        digest.hash_haval224(\u003cstring\u003e);\n        digest.hash_haval256(\u003cstring\u003e);\n        digest.hash_ripemd128(\u003cstring\u003e);\n        digest.hash_ripemd160(\u003cstring\u003e);\n        digest.hash_ripemd256(\u003cstring\u003e);\n        digest.hash_ripemd320(\u003cstring\u003e);\n        digest.hash_tiger(\u003cstring\u003e);\n        digest.hash_tiger128(\u003cstring\u003e);\n        digest.hash_tiger160(\u003cstring\u003e);\n        digest.hash_snefru128(\u003cstring\u003e);\n        digest.hash_snefru256(\u003cstring\u003e);\n\nDESCRIPTION\n===========\n\nVarnish Module (vmod) for computing HMAC, message digests and working with\nbase64.\n\nAll HMAC- and hash-functionality is provided by libmhash, while base64 is\nimplemented locally.\n\nFUNCTIONS\n=========\n\nExample VCL::\n\n\tbackend foo { ... };\n\n\timport digest;\n\n\tsub vcl_recv {\n\t\tif (digest.hmac_sha256(\"key\",req.http.x-data) != req.http.x-data-sig)\n\t\t{\n\t\t\treturn (synth(401, \"Naughty user!\"));\n\t\t}\n\t}\n\n\nhmac_(hash)\n-----------\n\nPrototype\n        ::\n\n\t        digest.hmac_md5(\u003ckey\u003e,\u003cmessage\u003e);\n\t        digest.hmac_sha1(\u003ckey\u003e, \u003cmessage\u003e);\n\t        digest.hmac_sha256(\u003ckey\u003e, \u003cmessage));\nReturns\n        String. Hex-encoded prepended with 0x.\nDescription\n        All the various hmac-functions work the same, but use a different\n\thash mechanism.\nExample\n        ::\n\n                set resp.http.x-data-sig =\n                        digest.hmac_sha256(\"secretkey\",resp.http.x-data);\n\nbase64, base64url, base64url_nopad\n----------------------------------\n\nPrototype\n        ::\n\n                digest.base64(\u003cstring\u003e);\n                digest.base64url(\u003cstring\u003e);\n                digest.base64url_nopad(\u003cstring\u003e);\nReturns\n        String\nDescription\n        Returns the base64-encoded version of the input-string. The\n        base64url-variant uses base64 url-encoding (+/ replaced by -_) and\n        the base64url_nopad does the same, but avoids adding padding. The\n        latter is more commonly used, though an (allowed) exception to the\n        RFC4648.\nExample\n        ::\n\n                set resp.http.x-data-sig =\n                        digest.base64({\"content with\n                        newline in it\"});\n\nbase64_hex, base64url_hex, base64url_nopad_hex\n-----------------------------------------------\n\nPrototype\n        ::\n\n                digest.base64_hex(\u003cstring\u003e);\n                digest.base64url_hex(\u003cstring\u003e);\n                digest.base64url_nopad_hex(\u003cstring\u003e);\nReturns\n        String\nDescription\n        Returns the base64-encoded version of the hex encoded input-string. The\n        input-string can start with an optional 0x. Input is hex-decoded into binary\n        and the encoding is identical to base64, base64url, and base64url_nopad.\nExample\n        ::\n\n                set resp.http.x-data-sig =\n                        digest.base64_hex(\"0xdd26bfddf122c1055d4c\");\n\nhash_(algorithm)\n----------------\n\nPrototype\n        ::\n\n                digest.hash_sha1(\u003cstring\u003e);\n                digest.hash_sha224(\u003cstring\u003e);\n                digest.hash_sha256(\u003cstring\u003e);\n                digest.hash_sha384(\u003cstring\u003e);\n                digest.hash_sha512(\u003cstring\u003e);\n                digest.hash_gost(\u003cstring\u003e);\n                digest.hash_md2(\u003cstring\u003e);\n                digest.hash_md4(\u003cstring\u003e);\n                digest.hash_md5(\u003cstring\u003e);\n                digest.hash_crc32(\u003cstring\u003e);\n                digest.hash_crc32b(\u003cstring\u003e);\n                digest.hash_adler32(\u003cstring\u003e);\n                digest.hash_haval128(\u003cstring\u003e);\n                digest.hash_haval160(\u003cstring\u003e);\n                digest.hash_haval192(\u003cstring\u003e);\n                digest.hash_haval224(\u003cstring\u003e);\n                digest.hash_haval256(\u003cstring\u003e);\n                digest.hash_ripemd128(\u003cstring\u003e);\n                digest.hash_ripemd160(\u003cstring\u003e);\n                digest.hash_ripemd256(\u003cstring\u003e);\n                digest.hash_ripemd320(\u003cstring\u003e);\n                digest.hash_tiger(\u003cstring\u003e);\n                digest.hash_tiger128(\u003cstring\u003e);\n                digest.hash_tiger160(\u003cstring\u003e);\n                digest.hash_snefru128(\u003cstring\u003e);\n                digest.hash_snefru256(\u003cstring\u003e);\nReturns\n        String\nDescription\n        Computes the digest/hash of the supplied, using the specified hash\n        algorithm. If in doubt as to which to pick, use SHA256. For\n        detailed discussions, see The Internet.\nExample\n        ::\n\n                set resp.http.x-data-md5 =\n                        digest.hash_md5(resp.http.x-data);\n\nbase64_decode, base64url_decode, base64url_nopad_decode\n-------------------------------------------------------\n\nPrototype\n        ::\n\n                digest.base64_decode(\u003cstring\u003e);\n                digest.base64url_decode(\u003cstring\u003e);\n                digest.base64url_nopad_decode(\u003cstring\u003e);\nReturns\n        String\nDescription\n        Decodes the bas64 and base64url-encoded strings. All functions\n        treat padding the same, meaning base64url_decode and\n        base64url_nopad_decode are identical, but available for consistency\n        and practicality.\nExample\n        ::\n                synthetic(digest.base64_decode(req.http.x-parrot));\n\nversion\n-------\n\nPrototype\n        ::\n\n                digest.version()\nReturns\n        string\nDescription\n        Returns the string constant version-number of the digest vmod.\nExample\n        ::\n\n                set resp.http.X-digest-version = digest.version();\n\n\nINSTALLATION\n============\n\nThe source tree is based on autotools to configure the building, and\ndoes also have the necessary bits in place to do functional unit tests\nusing the ``varnishtest`` tool.\n\nBuilding requires the Varnish header files and uses pkg-config to find\nthe necessary paths.\n\nUsage::\n\n ./autogen.sh\n ./configure\n\nIf you have installed Varnish to a non-standard directory, call\n``autogen.sh`` and ``configure`` with ``PKG_CONFIG_PATH`` pointing to\nthe appropriate path. For example, when varnishd configure was called\nwith ``--prefix=$PREFIX``, use\n\n PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig\n export PKG_CONFIG_PATH\n\nMake targets:\n\n* make - builds the vmod.\n* make install - installs your vmod.\n* make check - runs the unit tests in ``src/tests/*.vtc``\n* make distcheck - run check and prepare a tarball of the vmod.\n\n\nAUTHOR\n======\n\nOriginal author: Kristian Lyngstøl \u003copensource@varnish-software.com\u003e.\n\nThis Vmod was written for Media Norge, Schibsted and others.\n\nThe bulk of the functionality is acquired through libmhash.\n\n\nBUGS\n====\n\nNo bugs at all!\n\nIf the key is NULL for hmac-functions, the function will fail and return\nNULL itself, and do no hmac-computation at all. This should be used as an\nindication of some greater flaw in your software/VCL. (I.e.: Your key\nshould be under your control, not user-supplied without verification).\n\nThe `base64url_nopad_decode()` and `base64url_decode()` functions do not\ndiffer much. The exception is that nopad_decode() does not know about\npadding at all, and might get confused if the input actually is padded.\n\nSEE ALSO\n========\n\n* libmhash\n* varnishd(1)\n* vcl(7)\n* https://github.com/varnish/libvmod-digest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarnish%2Flibvmod-digest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarnish%2Flibvmod-digest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarnish%2Flibvmod-digest/lists"}