version 1.2, 2000/08/21 08:31:21 |
version 1.5, 2015/08/08 14:19:41 |
|
|
* shall be made on your publication or presentation in any form of the |
* shall be made on your publication or presentation in any form of the |
* results obtained by use of the SOFTWARE. |
* results obtained by use of the SOFTWARE. |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification |
* e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification |
* for such modification or the source code of the modified part of the |
* for such modification or the source code of the modified part of the |
* SOFTWARE. |
* SOFTWARE. |
* |
* |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/sha1.c,v 1.1.1.1 1999/12/03 07:39:07 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/sha1.c,v 1.4 2001/10/09 01:36:07 noro Exp $ |
*/ |
*/ |
/* Implementation of NIST's Secure Hash Algorithm (FIPS 180) |
/* Implementation of NIST's Secure Hash Algorithm (FIPS 180) |
* Lightly bummed for execution efficiency. |
* Lightly bummed for execution efficiency. |
Line 163 int main(int argc, char **argv) |
|
Line 163 int main(int argc, char **argv) |
|
break; |
break; |
default: |
default: |
fprintf(stderr, "Unrecognized flag: %c\n", *s); |
fprintf(stderr, "Unrecognized flag: %c\n", *s); |
|
#if defined(__MINGW32__) || defined(__MINGW64__) |
|
fflush(stderr); |
|
#endif |
return FALSE; |
return FALSE; |
} |
} |
else /* Process a file */ |
else /* Process a file */ |
Line 335 static void nist_guts(int file_flag, /* Input from mem |
|
Line 338 static void nist_guts(int file_flag, /* Input from mem |
|
if (nread < 64) /* Partial block? */ |
if (nread < 64) /* Partial block? */ |
{ |
{ |
nbits = nread << 3; /* Length: bits */ |
nbits = nread << 3; /* Length: bits */ |
if ((lo_length += nbits) < nbits) |
if ((int)(lo_length += nbits) < nbits) |
hi_length++; /* 64-bit integer */ |
hi_length++; /* 64-bit integer */ |
|
|
if (nread < 64 && ! padded) /* Append a single bit */ |
if (nread < 64 && ! padded) /* Append a single bit */ |
{ |
{ |
d.B[nread++] = 0x80; /* Using up next byte */ |
d.B[nread++] = (char)0x80; /* Using up next byte */ |
padded = TRUE; /* Single bit once */ |
padded = TRUE; /* Single bit once */ |
} |
} |
for (i = nread; i < 64; i++) /* Pad with nulls */ |
for (i = nread; i < 64; i++) /* Pad with nulls */ |