Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
sha1.h
00001 /* 00002 * sha1.h 00003 * 00004 * Description: 00005 * This is the header file for code which implements the Secure 00006 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published 00007 * April 17, 1995. 00008 * 00009 * Many of the variable names in this code, especially the 00010 * single character names, were used because those were the names 00011 * used in the publication. 00012 * 00013 * Please read the file sha1.c for more information. 00014 * 00015 */ 00016 00017 #ifndef _SHA1_H_ 00018 #define _SHA1_H_ 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 //#include <stdint.h> 00025 typedef unsigned long uint32_t; 00026 typedef int int_least16_t; 00027 typedef unsigned char uint8_t; 00028 00029 /* 00030 * If you do not have the ISO standard stdint.h header file, then you 00031 * must typdef the following: 00032 * name meaning 00033 * uint32_t unsigned 32 bit integer 00034 * uint8_t unsigned 8 bit integer (i.e., unsigned char) 00035 * int_least16_t integer of >= 16 bits 00036 * 00037 */ 00038 00039 #ifndef _SHA_enum_ 00040 #define _SHA_enum_ 00041 enum 00042 { 00043 shaSuccess = 0, 00044 shaNull, /* Null pointer parameter */ 00045 shaInputTooLong, /* input data too long */ 00046 shaStateError /* called Input after Result */ 00047 }; 00048 #endif 00049 #define SHA1HashSize 20 00050 00051 /* 00052 * This structure will hold context information for the SHA-1 00053 * hashing operation 00054 */ 00055 typedef struct SHA1Context 00056 { 00057 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */ 00058 00059 uint32_t Length_Low; /* Message length in bits */ 00060 uint32_t Length_High; /* Message length in bits */ 00061 00062 /* Index into message block array */ 00063 int_least16_t Message_Block_Index; 00064 uint8_t Message_Block[64]; /* 512-bit message blocks */ 00065 00066 int Computed; /* Is the digest computed? */ 00067 int Corrupted; /* Is the message digest corrupted? */ 00068 } SHA1Context; 00069 00070 /* 00071 * Function Prototypes 00072 */ 00073 00074 int SHA1Reset( SHA1Context *); 00075 int SHA1Input( SHA1Context *, 00076 const uint8_t *, 00077 unsigned int); 00078 int SHA1Result( SHA1Context *, 00079 uint8_t Message_Digest[SHA1HashSize]); 00080 00081 #ifdef __cplusplus 00082 } 00083 #endif 00084 00085 #endif
Generated on Wed Jul 20 2022 04:19:30 by
1.7.2