コード例 #1
0
ファイル: main.c プロジェクト: hksonngan/mytesgnikrow
int main()
{
	int i;
	int Nr = 0;
	int Nk = 0;
	unsigned char Key[32]= {0x00  ,0x01  ,0x02  ,0x03  ,0x04  ,0x05  ,0x06  ,0x07  ,0x08  ,0x09  ,0x0a  ,0x0b  ,0x0c  ,0x0d  ,0x0e  ,0x0f};
	unsigned char in[16]= {0x00  ,0x11  ,0x22  ,0x33  ,0x44  ,0x55  ,0x66  ,0x77  ,0x88  ,0x99  ,0xaa  ,0xbb  ,0xcc  ,0xdd  ,0xee  ,0xff};
	unsigned char out[16];
	InitUART1();

	while(Nr!=128 && Nr!=192 && Nr!=256)
	{
		SendString("Enter the length of Key(128, 192 or 256 only): ");
		Nr = GetKey();
	}

	Nk = Nr / 32;
	Nr = Nk + 6;
	
	KeyExpansion(Key, Nk, Nr);
	Cipher(in, out, Nr);

	SendString("Text encrypted: ");
	for(i = 0; i < Nb*4; i++)
	{
		SendStringFromNum(out[i]);		
	} 
	SendEnter();
	while(1);
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Inicialización general del Kit de acuerdo al uso que se le dará.
//-----------------------------------------------------------------------------
void InicializarKit ( void )
{
	InicPLL();
	InicSysTick();
	InitUART1();

}
コード例 #3
0
/****************************************************************************
 Function
    InitUART

 Description
    Initialize the Tiva UART modules 1, 2, and 5
****************************************************************************/
void InitUART(void) {
    InitUART1();
    InitUART2();
    InitUART5();
}