티스토리 뷰
/*******************************************************************************
* This source code "SEED_test_KISA.c" is not the official souce code.
* This source code is the only example.
* This source code show how the encryption and decryption functions are operated.
* This source code can compare the standard test vector with the result.
*
*******************************************************************************/
/******************************* Include files ********************************/
#include "SEED_KISA.h"
/*******************************SEED test code ********************************/
void main()
{
DWORD pdwRoundKey[32]; // Round keys for encryption or decryption
BYTE pbUserKey[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // User secret key
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
BYTE pbData[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, // input plaintext to be encrypted
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
int i;
// Print user secret key
printf ("Key : ");
for (i=0;i<16;i++)
printf("%02X ",pbUserKey[i]);
// Print plaintext to be encrypted
printf ("\nPlaintext : ");
for (i=0;i<16;i++)
printf("%02X ",pbData[i]);
// Derive roundkeys from user secret key
SeedRoundKey(
pdwRoundKey,
pbUserKey);
// Encryption
printf ("\n\nEncryption....\n");
SeedEncrypt(
pbData,
pdwRoundKey);
// print encrypted data(ciphertext)
printf ("Ciphertext : ");
for (i=0;i<16;i++)
printf("%02X ",pbData[i]);
// Decryption
printf ("\n\nDecryption....\n");
SeedDecrypt(
pbData,
pdwRoundKey);
// Print decrypted data(plaintext)
printf ("Plaintext : ");
for (i=0;i<16;i++)
printf("%02X ",pbData[i]);
// Print round keys at round i
printf ("\n\nRound Key : \n");
for (i=0;i<16;i++) {
printf("K%2d,0 : %08X\t", i+1, pdwRoundKey[2*i]);
printf("K%2d,1 : %08X\n", i+1, pdwRoundKey[2*i+1]);
}
}
'P rogramming > C conf' 카테고리의 다른 글
| memset() 사용법 (0) | 2012.09.13 |
|---|---|
| struct timeval 사용 (0) | 2012.09.13 |
| getopt (0) | 2012.09.11 |
| AF PF 차이 (0) | 2012.09.10 |
| Shared Memmory (0) | 2012.09.10 |
| 함수 포인터의 유용성 : 동적바인딩 (0) | 2012.09.05 |
| KISA의 SEED test src (0) | 2012.08.23 |
| Compile Error : LINK : fatal error LNK1561: 진입점이 정의되어야 합니다 (0) | 2012.08.23 |
- Total
- 331,919
- Today
- 0
- Yesterday
- 89
- PolyBridge1-5
- c#
- 좋은글귀
- PolyBridge1-4
- 리눅스
- PolyBridge
- PolyBridge하는법
- C# 판넬 예제
- 알프스목초지1-4
- 폴리브릿지
- DaleEvans
- PolyBridge1-2
- ted
- C# 패널 예제
- 알프스목초지1-3
- 알프스목초지1-2
- 믿는다는것
- 1Day1Sentence
- 알프스목초지1-1
- 자신만의향
- C# 패널
- Nina Fedoroff
- PolyBridge1-3
- Joseph Redmon
- 알프스목초지1-5
- OnlyICan
- 인생의시간
- 사람의인생
- PolyBridge1-1
- 분할작업
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
- 2017/08 (4)
