sha1的几个函数的使用



id="cproIframe_u1507428" width="300" height="250" src="http://pos.baidu.com/acom?adn=0&at=103&aurl=&cad=1&ccd=24&cec=UTF-8&cfv=15&ch=0&col=zh-CN&conOP=0&cpa=1&dai=2&dis=0&ltr=&ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F2177623.html&lunum=6&n=83099053_cpr&pcs=1920x979&pis=10000x10000&ps=326x1186&psr=1920x1080&pss=1920x346&qn=315f9fabc5d7f3f2&rad=&rsi0=300&rsi1=250&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230080c0&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=&td_id=1507428&tn=text_default_300_250&tpr=1413421863872&ts=1&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1507428" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; font-size: 13px; background: transparent;">

SYNOPSIS

 #include <openssl/sha.h>
 unsigned char *SHA1(const unsigned char *d, unsigned long n,
                  unsigned char *md);
 int SHA1_Init(SHA_CTX *c);
 int SHA1_Update(SHA_CTX *c, const void *data,
                  unsigned long len);
 int SHA1_Final(unsigned char *md, SHA_CTX *c);

DESCRIPTION

SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160bit output.

SHA1()computes the SHA-1 message digest of the nbytes at d and places it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.

The following functions may be used if the message is not completely storedin memory:

SHA1_Init()initializes a SHA_CTX structure.

SHA1_Update()can be called repeatedly with chunks of themessage to be hashed (len bytes at data).

SHA1_Final()places the message digest in md, which must have space for SHA_DIGEST_LENGTH == 20 bytes of output, anderases the SHA_CTX.

Applications should use the higher level functionsEVP_DigestInit(3)etc. instead of calling the hash functions directly.

The predecessor of SHA-1, SHA, is also implemented, but it should be usedonly when backward compatibility is required.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值