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

  • 大小: 7KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-09
  • 語言: C/C++
  • 標簽: SHA1算法??

資源簡介

SHA1算法C語言完全實現的源代碼,里面另附測試代碼!可直接運行的。

資源截圖

代碼片段和文件信息

/*
?*??sha.cpp
?*
?*??Copyright?(C)?1998?2009
?*??Paul?E.?Jones?
?*??All?Rights?Reserved
?*
?*****************************************************************************
?*??$Id:?sha.c?12?2009-06-22?19:34:25Z?paulej?$
?*****************************************************************************
?*
?*??Description:
?*??????This?utility?will?display?the?message?digest?(fingerprint)?for
?*??????the?specified?file(s).
?*
?*??Portability?Issues:
?*??????None.
?*/

#include?
#include?
#ifdef?WIN32
#include?
#endif
#include?
#include?“sha1.h“

/*
?*??Function?prototype
?*/
void?usage();


/*??
?*??main
?*
?*??Description:
?*??????This?is?the?entry?point?for?the?program
?*
?*??Parameters:
?*??????argc:?[in]
?*??????????This?is?the?count?of?arguments?in?the?argv?array
?*??????argv:?[in]
?*??????????This?is?an?array?of?filenames?for?which?to?compute?message
?*??????????digests
?*
?*??Returns:
?*??????Nothing.
?*
?*??Comments:
?*
?*/
int?main(int?argc?char?*argv[])
{
????SHA1Context?sha;????????????????/*?SHA-1?context?????????????????*/
????FILE????????*fp;????????????????/*?File?pointer?for?reading?files*/
????char????????c;??????????????????/*?Character?read?from?file??????*/
????int?????????i;??????????????????/*?Counter???????????????????????*/
????int?????????reading_stdin;??????/*?Are?we?reading?standard?in????*/
????int?????????read_stdin?=?0;?????/*?Have?we?read?stdin????????????*/

????/*
?????*??Check?the?program?arguments?and?print?usage?information?if?-?
?????*??or?--help?is?passed?as?the?first?argument.
?????*/
????if?(argc?>?1?&&?(!strcmp(argv[1]“-?“)?||
????????!strcmp(argv[1]“--help“)))
????{
????????usage();
????????return?1;
????}

????/*
?????*??For?each?filename?passed?in?on?the?command?line?calculate?the
?????*??SHA-1?value?and?display?it.
?????*/
????for(i?=?0;?i?????{
????????/*
?????????*??We?start?the?counter?at?0?to?guarantee?entry?into?the?for
?????????*??loop.?So?if?‘i‘?is?zero?we?will?increment?it?now.??If?there
?????????*??is?no?argv[1]?we?will?use?STDIN?below.
?????????*/
????????if?(i?==?0)
????????{
????????????i++;
????????}

????????if?(argc?==?1?||?!strcmp(argv[i]“-“))
????????{
#ifdef?WIN32
????????????setmode(fileno(stdin)?_O_BINARY);
#endif
????????????fp?=?stdin;
????????????reading_stdin?=?1;
????????}
????????else
????????{
????????????if?(!(fp?=?fopen(argv[i]“rb“)))
????????????{
????????????????fprintf(stderr
????????????????????????“sha:?unable?to?open?file?%s\n“
????????????????????????argv[i]);
????????????????return?2;
????????????}
????????????reading_stdin?=?0;
????????}

????????/*
?????????*??We?do?not?want?to?read?STDIN?multiple?times
?????????*/
????????if?(reading_stdin)
????????{
????????????if?(read_stdin)
????????????{
????????????????continue;
????????????}

????????????read_stdin?=?1;
????????}

????????/*
?????????*??Reset?the?SHA-1?context?and?process?input
?????????*/
????????SHA1Reset(&sha);

????????c?=?fgetc(

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????4176??2009-06-23?04:21??sha1-c\sha.c
?????文件???????10382??2009-06-23?04:21??sha1-c\sha1.c
?????文件????????1574??2009-06-23?04:21??sha1-c\sha1.h
?????文件????????2513??2009-06-23?04:21??sha1-c\shatest.c
?????目錄???????????0??2009-06-23?04:24??sha1-c\
?????文件?????????702??2009-06-23?04:33??sha1-c\license.txt

評論

共有 條評論