91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

SHA常用算法實現(SHA-1, SHA256, SHA384, SHA512),使用C語言,包含4個相對獨立的算法,并有demo調用示例。

資源截圖

代碼片段和文件信息

/*-
?*?Copyright?(c)?2001-2003?Allan?Saddi?
?*?All?rights?reserved.
?*
?*?Redistribution?and?use?in?source?and?binary?forms?with?or?without
?*?modification?are?permitted?provided?that?the?following?conditions
?*?are?met:
?*?1.?Redistributions?of?source?code?must?retain?the?above?copyright
?*????notice?this?list?of?conditions?and?the?following?disclaimer.
?*?2.?Redistributions?in?binary?form?must?reproduce?the?above?copyright
?*????notice?this?list?of?conditions?and?the?following?disclaimer?in?the
?*????documentation?and/or?other?materials?provided?with?the?distribution.
?*
?*?THIS?SOFTWARE?IS?PROVIDED?BY?ALLAN?SADDI?AND?HIS?CONTRIBUTORS?‘‘AS?IS‘‘
?*?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT?LIMITED?TO?THE
?*?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR?A?PARTICULAR?PURPOSE
?*?ARE?DISCLAIMED.??IN?NO?EVENT?SHALL?ALLAN?SADDI?OR?HIS?CONTRIBUTORS?BE
?*?LIABLE?FOR?ANY?DIRECT?INDIRECT?INCIDENTAL?SPECIAL?EXEMPLARY?OR
?*?CONSEQUENTIAL?DAMAGES?(INCLUDING?BUT?NOT?LIMITED?TO?PROCUREMENT?OF
?*?SUBSTITUTE?GOODS?OR?SERVICES;?LOSS?OF?USE?DATA?OR?PROFITS;?OR?BUSINESS
?*?INTERRUPTION)?HOWEVER?CAUSED?AND?ON?ANY?THEORY?OF?LIABILITY?WHETHER?IN
?*?CONTRACT?STRICT?LIABILITY?OR?TORT?(INCLUDING?NEGLIGENCE?OR?OTHERWISE)
?*?ARISING?IN?ANY?WAY?OUT?OF?THE?USE?OF?THIS?SOFTWARE?EVEN?IF?ADVISED?OF?THE
?*?POSSIBILITY?OF?SUCH?DAMAGE.
?*
?*?$Id:?sha.c?351?2003-02-23?23:24:40Z?asaddi?$
?*/

#ifdef?HAVE_CONFIG_H
#include?
#endif?/*?HAVE_CONFIG_H?*/

#if?HAVE_INTTYPES_H
#?include?
#else
#?if?HAVE_STDINT_H
#??include?
#?endif
#endif

#include?
#include?
#include?
#include?
#if?HAVE_UNISTD_H
#include?
#endif?/*?HAVE_UNISTD_H?*/

#include?“sha1.h“
#include?“sha256.h“
#include?“sha384.h“
#include?“sha512.h“

#include?“version.h“

#ifndef?lint
static?const?char?rcsid[]?=
“$Id:?sha.c?351?2003-02-23?23:24:40Z?asaddi?$“;
#endif?/*?!lint?*/

static?char?*prog;

#define?SHA_BUFFER_SIZE?65536
static?uint8_t?*buffer;

static?int
shaFile?(char?*name?FILE?*f?int?which)
{
??union?{
????SHA1Context?sha1;
????SHA256Context?sha256;
????SHA384Context?sha384;
????SHA512Context?sha512;
??}?s;
??size_t?len;
??uint8_t?hash[SHA512_HASH_SIZE];
??int?hashLen?i;
??int?success?=?1;

??switch?(which)?{
??case?1:
????SHA1Init?(&s.sha1);
????break;
??case?2:
????SHA256Init?(&s.sha256);
????break;
??case?3:
????SHA384Init?(&s.sha384);
????break;
??case?5:
????SHA512Init?(&s.sha512);
????break;
??default:
????abort?();
??}

??while?((len?=?fread?(buffer?1?SHA_BUFFER_SIZE?f))?>?0)?{
????switch?(which)?{
????case?1:
??????SHA1Update?(&s.sha1?buffer?len);
??????break;
????case?2:
??????SHA256Update?(&s.sha256?buffer?len);
??????break;
????case?3:
??????SHA384Update?(&s.sha384?buffer?len);
??????break;
????case?5:
??????SHA512Update?(&s.sha512?buffer?len);
??????break;
????default:
??????abort?();
????}
??}

??if?(ferror?(f))?{
#if?HAVE_STRERROR
????fprintf?(stderr?“

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????6283??2003-02-25?05:23??SHA\sha.c

?????文件??????14989??2003-07-26?05:57??SHA\sha1.c

?????文件???????2209??2003-02-24?06:30??SHA\sha1.h

?????文件??????12585??2017-11-06?13:20??SHA\sha256.c

?????文件???????2244??2003-02-24?06:30??SHA\sha256.h

?????文件??????13015??2003-07-26?05:57??SHA\sha384.c

?????文件???????2252??2003-02-24?06:30??SHA\sha384.h

?????文件??????13066??2003-07-26?05:58??SHA\sha512.c

?????文件???????2248??2003-02-24?06:30??SHA\sha512.h

?????文件???????9824??2017-11-06?11:49??SHA\shatest.c

?????文件????????143??2003-07-26?06:00??SHA\version.h

?????目錄??????????0??2017-11-06?13:27??SHA

-----------?---------??----------?-----??----

????????????????78858????????????????????12


評論

共有 條評論