在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Lekensteyn/luagcrypt开源软件地址(OpenSource Url):https://github.com/Lekensteyn/luagcrypt开源编程语言(OpenSource Language):C 53.3%开源软件介绍(OpenSource Introduction):luagcryptLuagcrypt is a Lua binding to the Libgcrypt cryptographic library. Symmetric encryption/decryption (AES, etc.) and hashing (MD5, SHA-1, SHA-2, etc.) are supported. It is compatible with Lua 5.1, 5.2 and 5.3 and runs on Linux, OS X and Windows. InstallationThe minimum requirement is Libgcrypt 1.4.2 (libgcrypt-11), but at least
Libgcrypt 1.6.0 (libgcrypt-20) is recommended.
After ensuring that the Lua and Libgcrypt development headers and libraries are
available, you can invoke An alternative cross-platform method uses LuaRocks. Once you have checked out this repository, you can invoke:
Note for Windows users: the rockspec file uses libgcrypt-20 which is used since Wireshark 1.12. Older Wireshark versions use Libgcrypt 1.4.6 (libgcrypt-11). Header files and precompiled libraries (libgcrypt-20.dll and its dependency libgpg-error-0.dll) can be found here:
Be sure to build with Lua 5.2 (64-bit, 32-bit) if you intend to use the library with Wireshark. DocumentationThe interface closely mimics the Libgcrypt API. The following text assume
the module name to be Available functions under the module scope:
For the documentation of available functions, see the Libgcrypt manual. The
above constructors correspond to the An error is thrown if any error occurs, that is, when the Libgcrypt functions return non-zero. (The error message text may change in the future.) Constants like ExampleThe test suite contains representative examples, see luagcrypt_test.lua. Another full example to calculate a SHA-256 message digest for standard input: local gcrypt = require("luagcrypt")
-- Initialize the gcrypt library (required for standalone applications that
-- do not use Libgcrypt themselves).
gcrypt.init()
-- Convert bytes to their hexadecimal representation
function tohex(s)
local hex = string.gsub(s, ".", function(c)
return string.format("%02x", string.byte(c))
end)
return hex
end
local md = gcrypt.Hash(gcrypt.MD_SHA256)
-- Keep reading from standard input until EOF and update the hash state
repeat
local data = io.read(4096)
if data then
md:write(data)
end
until not data
-- Extract the hash as hexadecimal value
print(tohex(md:read())) TestsThe basic test suite requires just Libgcrypt and Lua and can be invoked with
Run the code coverage checker with:
LicenseCopyright (c) 2016 Peter Wu [email protected] This project ("luagcrypt") is licensed under the MIT license. See the LICENSE file for more details. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论