{"id":17254423,"url":"https://github.com/lekensteyn/luagcrypt","last_synced_at":"2025-07-08T12:44:01.983Z","repository":{"id":40625815,"uuid":"54408523","full_name":"Lekensteyn/luagcrypt","owner":"Lekensteyn","description":"luagcrypt is a Lua interface to the libgcrypt library, written in C.","archived":false,"fork":false,"pushed_at":"2022-03-28T15:00:34.000Z","size":36,"stargazers_count":26,"open_issues_count":4,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T19:52:29.832Z","etag":null,"topics":["libgcrypt","lua","lua-binding"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lekensteyn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-21T17:21:52.000Z","updated_at":"2024-01-07T15:19:30.000Z","dependencies_parsed_at":"2022-09-20T12:25:36.103Z","dependency_job_id":null,"html_url":"https://github.com/Lekensteyn/luagcrypt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lekensteyn%2Fluagcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lekensteyn%2Fluagcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lekensteyn%2Fluagcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lekensteyn%2Fluagcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lekensteyn","download_url":"https://codeload.github.com/Lekensteyn/luagcrypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248826820,"owners_count":21167759,"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":["libgcrypt","lua","lua-binding"],"created_at":"2024-10-15T07:08:50.032Z","updated_at":"2025-04-14T05:32:23.790Z","avatar_url":"https://github.com/Lekensteyn.png","language":"C","readme":"[![Build Status](https://travis-ci.org/Lekensteyn/luagcrypt.svg?branch=master)](https://travis-ci.org/Lekensteyn/luagcrypt)\n[![Build status](https://ci.appveyor.com/api/projects/status/9rlt1msbtnriy04q?svg=true)](https://ci.appveyor.com/project/Lekensteyn/luagcrypt)\n[![Coverage Status](https://coveralls.io/repos/github/Lekensteyn/luagcrypt/badge.svg?branch=master)](https://coveralls.io/github/Lekensteyn/luagcrypt?branch=master)\n\nluagcrypt\n=========\nLuagcrypt is a Lua binding to the Libgcrypt cryptographic library.\nSymmetric encryption/decryption (AES, etc.) and hashing (MD5, SHA-1, SHA-2,\netc.) are supported.\n\nIt is compatible with Lua 5.1, 5.2 and 5.3 and runs on Linux, OS X and Windows.\n\n\nInstallation\n------------\nThe minimum requirement is Libgcrypt 1.4.2 (libgcrypt-11), but at least\nLibgcrypt 1.6.0 (libgcrypt-20) is recommended.\nAfter ensuring that the Lua and Libgcrypt development headers and libraries are\navailable, you can invoke `make` to build `luagcrypt.so` with Lua 5.2. See the\n[Makefile](Makefile) file for available variables.\n\nAn alternative cross-platform method uses [LuaRocks](https://luarocks.org/).\nOnce you have checked out this repository, you can invoke:\n\n    luarocks make\n\nNote for Windows users: the rockspec file uses libgcrypt-20 which is used since\nWireshark 1.12. Older Wireshark versions use Libgcrypt 1.4.6 (libgcrypt-11).\nHeader files and precompiled libraries (libgcrypt-20.dll and its dependency\nlibgpg-error-0.dll) can be found here:\n\n - Libgcrypt 1.8.3 for Wireshark 3.0: [64-bit][10], [32-bit][11]\n   (libgcrypt-20.dll, should be compatible with Wireshark 2.4 as well)\n - Libgcrypt 1.7.6 for Wireshark 2.4/2.6: [64-bit][4], [32-bit][5]\n   (libgcrypt-20.dll)\n - Libgcrypt 1.6.2 for Wireshark 2.2/2.0/1.12: [64-bit][6], [32-bit][7]\n   (libgcrypt-11.dll)\n\nBe sure to build with Lua 5.2 ([64-bit][8], [32-bit][9]) if you intend to use\nthe library with Wireshark.\n\nDocumentation\n-------------\nThe interface closely mimics the [Libgcrypt API][0]. The following text assume\nthe module name to be `gcrypt = require(\"luagcrypt\")` for convenience.\n\nAvailable functions under the module scope:\n - [Symmetric cryptography][1] - `cipher = gcrypt.Cipher(algo, mode[, flags])`\n - [Hashing][2] - `md = gcrypt.Hash(algo[, flags])`\n - [`version = gcrypt.check_version([req_version])`][3] - retrieve the Libgcrypt\n   version string. If `req_version` is given, then `nil` may be returned if the\n   required version is not satisfied.\n\nFor the documentation of available functions, see the [Libgcrypt manual][0]. The\nabove constructors correspond to the `gcry_*_open` routines. Resource\ndeallocation (`gcry_*_close`) are handled implicitly by garbage collection.\nLength parameters are omitted when these can be inferred from the string length.\nFor example, Libgcrypt's `gcry_cipher_setkey(cipher, key, key_len)` matches\n`cipher:setkey(key)` in Lua.\n\nAn error is thrown if any error occurs, that is, when the Libgcrypt functions\nreturn non-zero. (The error message text may change in the future.)\n\nConstants like `GCRY_CIPHER_AES256` are exposed as `gcrypt.CIPHER_AES256`\n(without the `GCRY_` prefix).\n\nExample\n-------\nThe test suite contains representative examples, see\n[luagcrypt_test.lua](luagcrypt_test.lua).\n\nAnother full example to calculate a SHA-256 message digest for standard input:\n\n```lua\nlocal gcrypt = require(\"luagcrypt\")\n-- Initialize the gcrypt library (required for standalone applications that\n-- do not use Libgcrypt themselves).\ngcrypt.init()\n\n-- Convert bytes to their hexadecimal representation\nfunction tohex(s)\n    local hex = string.gsub(s, \".\", function(c)\n        return string.format(\"%02x\", string.byte(c))\n    end)\n    return hex\nend\n\nlocal md = gcrypt.Hash(gcrypt.MD_SHA256)\n\n-- Keep reading from standard input until EOF and update the hash state\nrepeat\n    local data = io.read(4096)\n    if data then\n        md:write(data)\n    end\nuntil not data\n\n-- Extract the hash as hexadecimal value\nprint(tohex(md:read()))\n```\n\nTests\n-----\nThe basic test suite requires just Libgcrypt and Lua and can be invoked with\n`make check` (which invokes `luagcrypt_test.lua`).\n\nRun the code coverage checker with:\n\n    make checkcoverage LUA_DIR=/usr\n\nLicense\n-------\nCopyright (c) 2016 Peter Wu \u003cpeter@lekensteyn.nl\u003e\n\nThis project (\"luagcrypt\") is licensed under the MIT license. See the\n[LICENSE](LICENSE) file for more details.\n\n [0]: https://gnupg.org/documentation/manuals/gcrypt/\n [1]: https://gnupg.org/documentation/manuals/gcrypt/Symmetric-cryptography.html\n [2]: https://gnupg.org/documentation/manuals/gcrypt/Hashing.html\n [3]: https://gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html\n [4]: https://anonsvn.wireshark.org/wireshark-win64-libs/tags/2017-02-15/packages/libgcrypt-1.7.6-win64ws.zip\n [5]: https://anonsvn.wireshark.org/wireshark-win32-libs/tags/2017-02-15/packages/libgcrypt-1.7.6-win32ws.zip\n [6]: https://anonsvn.wireshark.org/wireshark-win64-libs/tags/2016-12-12/packages/gnutls-3.2.15-2.9-win64ws.zip\n [7]: https://anonsvn.wireshark.org/wireshark-win32-libs/tags/2016-12-12/packages/gnutls-3.2.15-2.7-win32ws.zip\n [8]: https://anonsvn.wireshark.org/wireshark-win64-libs/tags/2016-08-31/packages/lua-5.2.4_Win64_dllw4_lib.zip\n [9]: https://anonsvn.wireshark.org/wireshark-win32-libs/tags/2016-08-31/packages/lua-5.2.4_Win32_dllw4_lib.zip\n [10]: https://anonsvn.wireshark.org/wireshark-win64-libs/tags/2018-08-04/packages/libgcrypt-1.8.3-win64ws.zip\n [11]: https://anonsvn.wireshark.org/wireshark-win32-libs/tags/2018-08-04/packages/libgcrypt-1.8.3-win32ws.zip\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekensteyn%2Fluagcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flekensteyn%2Fluagcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekensteyn%2Fluagcrypt/lists"}