⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decrypt.h

📁 STM32F10xx的LCD驱动源码
💻 H
字号:
/***************************************************************************
file name :Decrypt.h
    usage :It is the header file of the file Decrypt.c
*****************************************************************************/
#include "stm32f10x_lib.h"
#include "main.h"
#include <stdio.h>
#include "stm32f10x_map.h"


#define setbit( b, n) ((b) |= ( 1 << (n)))
#define getbit( b, n) (((b) & (1L<<n)) ? 1 : 0)
#define ifbit(x,y) if (getbit(x,y))

typedef struct
{
 u8  SeriaNumber_Address;
 u8  Decrypt_KeyH_Address;
 u8  Decrypt_KeyL_Address;
 u8  Sync_Counter1_Address;
 u8  Sync_Counter2_Address;
}KeyID_Address ;


extern u32 EEPR_ByteRead_Commend(u8 DATA_Address);
extern u8   Learn_Key_State;
extern u32  Decrupt_Keyl;
extern u32  Decrupt_Keyh;
extern DATA_STRUCT   Recived_Data;
 
/*********************************************************************
Founction Name :Decrption()
     Founction :Call this founction to decrypt the recived encrypted code,
                so you can validate whether the transmitter a legal one .
                if it is ,then you can take appropriate actions
     Peramater :none
        Output :none
          Note :
***********************************************************************/
void Decrption(KeyID KeyIDx,KeyID_Address  KeyIDx_Address);
/*********************************************************************
Founction Name :KeyGen()
     Founction :you can use this founction to generate the decrypt key 
                when the reciver is in learn mode. With this key generated ,
                you can decrypt the  encrypted partion of the recived code .
     Peramater :none 
        Output :none
          Note :
***********************************************************************/
KeyID KeyGen( void);
/*********************************************************************
Founction Name :Decrypt()
     Founction :             Perform the decrypt algorithm
     Peramater :u32    pih   The high 32 bits of the vender code
                u32    pil   The low 32 bits of the vender code
                u32    csr   The recived seria number or seed of the 
                             transmitter which is the first time transmit 
                             toward the reciver .
        Output :u32    csr   It is the low 32 bits of the 64 bits decrypt key you 
                             want to generate when the input csr is seed+0x20000000 
                             or Recived_Data.Seria_Number+0x20000000 , else ,if csr equal to
                             Seed+0x60000000 or Recived_Data.Seria_Number+0x60000000,
                             it is the high 32 bits of the decrypt key.  
          Note :
***********************************************************************/
 u32 Decrypt(u32 pih,u32 pil,  u32    csr);
/*********************************************************************
Founction Name :Learn_Key()
     Founction :                      To check whether the Learn_Key is being pressed.
     Peramater :none
        Output :u8  Learn_Key_Status  If Learn_Key_Status equal 1 ,
                                      it indicate the Learn_Key has 
                                      been pressed ddown, and the reciver 
                                      will enter the learn mode .
          Note :
***********************************************************************/
u8 Learn_Key(void);
u32 ReadKeyID32(u8 Data_Address); 
void WriteKeyID32(u32 Data,u8 Data_Write_To_Address);
KeyID  Read_KeyID_From_EEP( KeyID_Address  KeyIDx_Address);   
void  Write_KeyID_To_EEP(KeyID KeyIDx,KeyID_Address KeyIDx_Address);
void Code_Recive_Manage(void);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -