Published 23 Mar 2011, by
Shinichi Fuchita
OAuth,
twitter
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _SHA1_H_
00018 #define _SHA1_H_
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024
00025 typedef unsigned long uint32_t;
00026 typedef int int_least16_t;
00027 typedef unsigned char uint8_t;
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _SHA_enum_
00040 #define _SHA_enum_
00041 enum
00042 {
00043 shaSuccess = 0,
00044 shaNull,
00045 shaInputTooLong,
00046 shaStateError
00047 };
00048 #endif
00049 #define SHA1HashSize 20
00050
00051
00052
00053
00054
00055 typedef struct SHA1Context
00056 {
00057 uint32_t Intermediate_Hash[SHA1HashSize/4];
00058
00059 uint32_t Length_Low;
00060 uint32_t Length_High;
00061
00062
00063 int_least16_t Message_Block_Index;
00064 uint8_t Message_Block[64];
00065
00066 int Computed;
00067 int Corrupted;
00068 } SHA1Context;
00069
00070
00071
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