📄 xtunnelscvssha1.h
字号:
/* File: XTunnelsCVsSHA1.h Contains: SHA1 routines -- extracted from the VsUtils source tree 03.11.06 Copyright: (c) 2003 by Xten Networks, Inc., all rights reserved.*/#ifndef XTUNNELSCVSSHA1_H__E8983BF5_8446_4658_ADFB_6622FCCF7E7C_#define XTUNNELSCVSSHA1_H__E8983BF5_8446_4658_ADFB_6622FCCF7E7C_ 1#ifdef __MWERKS__#pragma once#endif // __MWERKS__// Windows compatibility defs#include <stdlib.h>typedef unsigned char BYTE;typedef unsigned long DWORD;#if VS_TARGET_OS_MAC#if _MSL_USING_MW_C_HEADERS// match <cstdint_mach.h>typedef unsigned long int uint32_t;typedef short int int_least16_t;#else// match BSDtypedef unsigned int uint32_t;typedef short int_least16_t;#endif // _MSL_USING_MW_C_HEADERS#elsetypedef unsigned int uint32_t;//typedef signed int int_least16_t;// match stdint.h declarationtypedef short int int_least16_t;#endif // VS_TARGET_OS_MACtypedef unsigned char uint8_t;#define SHA1HashSize 20#ifndef VS_IFDEF_SHA1_CONTEXT_STRUCT#define VS_IFDEF_SHA1_CONTEXT_STRUCT/* * This structure will hold context information for the SHA-1 * hashing operation */typedef struct SHA1Context{ uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */ uint32_t Length_Low; /* Message length in bits */ uint32_t Length_High; /* Message length in bits */ /* Index into message block array */ int_least16_t Message_Block_Index; uint8_t Message_Block[64]; /* 512-bit message blocks */ int Computed; /* Is the digest computed? */ int Corrupted; /* Is the message digest corrupted? */} SHA1Context;#endif // VS_IFDEF_SHA1_CONTEXT_STRUCTclass CVsSHA1 {public: CVsSHA1() {Init();} virtual ~CVsSHA1() {Destroy();} virtual bool Read( BYTE */*pBuffer*/, DWORD /*dwBytesToRead*/, DWORD */*pBytesRead*/ = NULL ) {return false;} // MD5 is a one-way operation and can not be read, use GetDigest virtual bool Write( const BYTE *pBuffer, DWORD dwBufferLength, DWORD *pBytesWritten = NULL ); virtual void Close(); void GetDigest(char* szOutDigest); const BYTE *GetDigestBytes() {return &(m_pMessage_Digest[0]);} DWORD GetDigestBytesLength() {return sizeof(m_pMessage_Digest);}private: void Init(); void Destroy();private: SHA1Context m_tContext; uint8_t m_pMessage_Digest[20];};void hmac_sha1( const BYTE *pInTextBlob, DWORD dwInTextBlobLength, const BYTE *pInKey, DWORD dwInKeyLength, unsigned char pOutDigest[20]);#endif // XTUNNELSCVSSHA1_H__E8983BF5_8446_4658_ADFB_6622FCCF7E7C_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -