前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >利用crypto++库,实现计算string的md5值

利用crypto++库,实现计算string的md5值

作者头像
一灰灰blog
发布2018-02-06 11:58:44
2.2K0
发布2018-02-06 11:58:44
举报
文章被收录于专栏:小灰灰小灰灰
代码语言:javascript
复制
#include <cryptopp/hex.h>
#include <cryptopp/files.h>
#include <cryptopp/md5.h>
代码语言:javascript
复制
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 
/*
 * Description: to calculate the hash of the message, and return it(string).
 * Input:
 * message: need to calculate its hash value
 * Output:
 * return the hash value(string) of the message.
 */
string md5_string(const string & message)
{
    string digest;
    Weak::MD5 md5;
    StringSource(message, true,
                new HashFilter(md5, new HexEncoder(new StringSink(digest))));
    return digest;
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档