【问题标题】:Is there any function to get the md5sum value of file in linux?有什么函数可以在linux中获取文件的md5sum值吗?
【发布时间】:2014-05-23 20:14:00
【问题描述】:

我想计算文件的 md5sum 值,而不是字符串。我发现有人使用过 openssl md5 功能。但它仅用于 string 。有没有什么函数可以用来获取文件的 md5sum 值,这等于在 linux 中使用 md5sum 命令。

【问题讨论】:

  • 查看 md5sum 的代码或使用 md5 lib。 1. 读取文件并将其保存在 buf 中 2. 使用 md5 lib 转换字符串 -> md5 摘要 3. 查看以下链接了解如何使用 MD5API stackoverflow.com/questions/7627723/…

标签: linux openssl md5sum


【解决方案1】:

您可以使用 openssl/md5.h 生成 md5sum 请参考How to get the MD5 hash of a file in C++?

在此链接中提供了使用 openssl 生成文件 md5sum 的示例

您也可以在 Linux 中使用以下命令生成文件的 md5sum

openssl dgst -md5 yourfile
md5sum yourfile

【讨论】:

    猜你喜欢
    • 2012-11-24
    • 2011-03-24
    • 1970-01-01
    • 1970-01-01
    • 2012-11-20
    • 2019-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多