์•”ํ˜ธ/์•”ํ˜ธ ๊ตฌํ˜„

[์•”ํ˜ธ๊ตฌํ˜„] AES

HHRR 2022. 7. 18. 16:27

** ๊ตฌํ˜„์€ ์—ฐ์Šต์ค‘์ด๋‹ˆ ์ฐธ๊ณ ํ•˜์ง€ ๋งˆ์„ธ์š”

[ ๊ตฌ์กฐ ]

- SPN ๊ตฌ์กฐ

์•ˆ์ „์„ฑ ํŒŒ๋ผ๋ฏธํ„ฐ ํ‚ค ๊ธธ์ด ๋ธ”๋ก ํฌ๊ธฐ ๋ผ์šด๋“œ ์ˆ˜
128 128 128 10
192 192 192 12
256 256 256 14

- AES๋Š” 128์„ ์ฃผ๋กœ ์“ด๋‹ค ํ•จ.

SubByte

- ์ž…๋ ฅ๊ฐ’์„ ๋ฐ”์ดํŠธ ๋‹จ์œ„๋กœ ์ชผ๊ฐฌ
- 128๋น„ํŠธ = 16 ๋ฐ”์ดํŠธ
- state : 16byte -> 4byte x 4byte ํ–‰๋ ฌ๋กœ ํ‘œํ˜„
- S-box ์—ฐ์‚ฐ (ํ…Œ์ด๋ธ” ์ฐธ์กฐ)

ShiftRow

- state ๊ฐ’์˜ ๊ฐ ํ–‰์„ ์‹œํ”„ํŠธ ์—ฐ์‚ฐ

MixColumn

- state ๊ฐ’์˜ ๊ฐ ์—ด์— 4x4 ํ–‰๋ ฌ์„ ๊ณฑํ•ด์ฃผ๋Š” ์—ฐ์‚ฐ

AddRoundKey

- ๋ผ์šด๋“œ ํ‚ค ๊ฐ’์„ ๊ฐ ๋ฐ”์ดํŠธ์— xor ํ•ด์คŒ

AES KeySchedule

- 128bit ํ‚ค -> 4byte word๋กœ ์ชผ๊ฐฌ (4๊ฐœ)

- RotWord : word๋ฅผ ๋ฐ”์ดํŠธ ๋‹จ์œ„๋กœ 1์นธ ์‹œํ”„ํŠธ
- SubWord : ๋ฐ”์ดํŠธ ๋‹จ์œ„๋กœ S-box ์—ฐ์‚ฐ
- Rcon : ๋ผ์šด๋“œ ์ƒ์ˆ˜ ๋”ํ•ด์คŒ

[ ๊ตฌํ˜„ ]

typedef unsigned char           BYTE;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "aes.h"



state[4][4];
Rkey[4][4];
BYTE Key[] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c };
//16์ง„์ˆ˜ 2๊ฐœ = 8bit, 1byte=8bit => 128bit=16byte๋กœ ๋งŒ๋“ค์–ด์„œ key์— ๋„ฃ๊ธฐ

'์•”ํ˜ธ > ์•”ํ˜ธ ๊ตฌํ˜„' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[์•”ํ˜ธ ๊ตฌํ˜„] RSA  (0) 2022.05.04