CLASS/Encryption

[암호론] 2022.05.31 AES 코드 구현 (Python)

sseni 2022. 5. 31. 13:42
728x90

[AES]

# 암호화

# SubBytes Transformation Table
Sbox = [
0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75,
0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84,
0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf,
0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8,
0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2,
0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73,
0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb,
0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79,
0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08,
0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a,
0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e,
0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf,
0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16 ]

# InvSubBytes Transformation Table
InvSbox = [
0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38,0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb,
0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87,0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb,
0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d,0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e,
0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2,0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25,
0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16,0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92,
0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda,0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84,
0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a,0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06,
0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02,0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b,
0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea,0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73,
0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85,0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e,
0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89,0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b,
0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20,0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4,
0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31,0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f,
0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d,0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef,
0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0,0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61,
0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26,0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d ]

# RCon Constants
RC = [ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36]

key = [0x24,0x75,0xA2,0xB3,0x34,0x75,0x56,0x88,
       0x31,0xE2,0x12,0x00,0x13,0xAA,0x54,0x87]

plainText = [0x00,0x04,0x12,0x14,0x12,0x04,0x12,0x00,
         0x0C,0x00,0x13,0x11,0x08,0x23,0x19,0x19]

cipherText = [0xBC,0x02,0x8B,0xD3,0xE0,0xE3,0xB1,0x95,
         0x55,0x0D,0x6D,0xF8,0xE6,0xF1,0x82,0x41]

Round key Generation

import copy

def printHex(value): # 16 진수 Table 출력
    for i in range(4):
        for j in range(4):
            print(value[i][j], end=' ')
    print()
    
def Dec2Hex(s): # 10 진수를 16 진수로 변환
    new_state = []
    for i in range(4):
        tmp = [format(s[i][j], 'X').zfill(2) for  j in range(4)]
        new_state.append(tmp)
    return new_state
    
def block2state(b): # 1차원 Table을 State 로 변환 시켜줌
    state = []
    for row in range(4):
        intm_list = [b[row*4 + col] for col in range(4)]
        state.append(intm_list)
    return state

def keyExpansion(key_state): # key Expansion in AES-128
    rk = [copy.deepcopy(key_state)]
    
    for r in range(1,11):
        new_state = [] 
        
        w0 = Xor_Col(rk[r-1][0], T_Generation(rk[r-1][3], r))
        new_state.append(w0)
        
        w1 = Xor_Col(rk[r-1][1], w0)
        new_state.append(w1)
        
        w2 = Xor_Col(rk[r-1][2], w1)
        new_state.append(w2)
        
        w3 = Xor_Col(rk[r-1][3], w2)
        new_state.append(w3)
        
        rk.append(new_state)
    return rk

def T_Generation(col, r):                                  # Key Expansion 에서 각 워드 별 T 생성
    new_col = [col[1], col[2], col[3], col[0]]             # 1 byte씩 Shift Left
    round_constant = [RC[r-1], 0, 0, 0]                    # Round 별 RCon Constants 값 저장 (RotWord)
    new_col2 = [Sbox[new_col[i]] for i in range(4)]       # SubByte 연산 (SubWord)
    new_col3 = Xor_Col(new_col2, round_constant)           # Constant 값과 XOR 연산
    return new_col3                                       # T

def Xor_Col(c1, c2):  # 1 Word XOR 연산
    new_col = [c1[i] ^ c2[i] for i in range(4)]
    return new_col


key_state = block2state(key)  # key 값을 State 로 변환
roundKey = keyExpansion(key_state)  # key Expansion 을 통해 각 Round 별 부분 키 생성


##### Round Key 값 16 진수로 변환해서 출력
hexResult = []  
for r in roundKey:
    hexResult.append(Dec2Hex(r))
    
print("Round Key >>")
idx = 0
for i in hexResult:
    if idx == 0:
        print("Pre-Round :", end=' ')
        printHex(i)
        idx += 1 
    else:
        print('Round',str(idx).zfill(2),': ', end=' ')
        printHex(i)
        idx += 1

Round Key >>
Pre-Round : 24 75 A2 B3 34 75 56 88 31 E2 12 00 13 AA 54 87 
Round 01 :  89 55 B5 CE BD 20 E3 46 8C C2 F1 46 9F 68 A5 C1 
Round 02 :  CE 53 CD 15 73 73 2E 53 FF B1 DF 15 60 D9 7A D4 
Round 03 :  FF 89 85 C5 8C FA AB 96 73 4B 74 83 13 92 0E 57 
Round 04 :  B8 22 DE B8 34 D8 75 2E 47 93 01 AD 54 01 0F FA 
Round 05 :  D4 54 F3 98 E0 8C 86 B6 A7 1F 87 1B F3 1E 88 E1 
Round 06 :  86 90 0B 95 66 1C 8D 23 C1 03 0A 38 32 1D 82 D9 
Round 07 :  62 83 3E B6 04 9F B3 95 C5 9C B9 AD F7 81 3B 74 
Round 08 :  EE 61 AC DE EA FE 1F 4B 2F 62 A6 E6 D8 E3 9D 92 
Round 09 :  E4 3F E3 BF 0E C1 FC F4 21 A3 5A 12 F9 40 C7 80 
Round 10 :  DB F9 2E 26 D5 38 D2 D2 F4 9B 88 C0 0D DB 4F 40 

Round

####### Pre-Round

def AddRoundKey(state , rkey): 
    new_state = []
    for col in range(4): # State 와 Round Key XOR 연산
        tmp = [state[col][row] ^ rkey[col][row] for row in range (4)]
        new_state.append(tmp)
    return new_state

print("Pre-Round >>")
input_state = block2state(plainText) # Plain Text 를 State 로 변환
print("Input State: ", end='')
printHex(Dec2Hex(input_state))  # Plain Text 를 16 진수로 출력

state = copy.deepcopy(input_state) 
new_state = AddRoundKey(state, roundKey[0])  # State 와 Pre-RoundKey 를 Add

print("Output State: ", end='')
printHex(Dec2Hex(new_state)) # Pre-Round Output 16 진수로 출력

print("Round Key: ", end='')
printHex(Dec2Hex(roundKey[0]))

Pre-Round >>
Input State: 00 04 12 14 12 04 12 00 0C 00 13 11 08 23 19 19 
Output State: 24 71 B0 A7 26 71 44 88 3D E2 01 11 1B 89 4D 9E 
Round Key: 24 75 A2 B3 34 75 56 88 31 E2 12 00 13 AA 54 87

####### 1 ~ 10 Round

def SubBytes(s): # State 를 SubBytes 연산
    state = []
    for row in range(4):  
        tmp = []
        for segment in range(4):
            tmp.append(Sbox[s[row][segment]])
        state.append(tmp)
    return state

def ShiftRows(s): # State 를 ShiftRows 연산
    state = []
    for row in range(4):  # 0 ~ 3 byte 만큼 Shift left 연산
        tmp = [] 
        for segment in range(4):  
            tmp.append(s[(row+segment)%4][segment]) 
        state.append(tmp)
    return state
 

def gf(a, b): # GF 곱셈 연산
    r = 0
    for _ in range(8):
        if (b & 1) == 1:  r = r ^ a
        if r > 0x100:  r = r ^ 0x100
            
        # keep r 8 bit
        hi_bit_set = (a & 0x80)
        a = a << 1
        
        if a > 0x100:  a = a ^ 0x100
        if hi_bit_set == 0x80:  a = a ^ 0x1b
        if a > 0x100:  a = a ^ 0x100
            
        b = b >> 1
        
        if b > 0x100:  b = b ^ 0x100
            
    return r

def MixColumns(state):  # MixColumns 연산
    out_state = []
    for i in range(4):   # 각 원소 마다 상수 행렬의 값과 State의 값 GF 곱셈 연산
        out_col = [0] * 4                           
        out_col[0] = gf(2,state[i][0]) ^ gf(3,state[i][1]) ^ gf(1,state[i][2]) ^ gf(1,state[i][3])
        out_col[1] = gf(1,state[i][0]) ^ gf(2,state[i][1]) ^ gf(3,state[i][2]) ^ gf(1,state[i][3])
        out_col[2] = gf(1,state[i][0]) ^ gf(1,state[i][1]) ^ gf(2,state[i][2]) ^ gf(3,state[i][3])
        out_col[3] = gf(3,state[i][0]) ^ gf(1,state[i][1]) ^ gf(1,state[i][2]) ^ gf(2,state[i][3])
        out_state.append(out_col) 
        
    return out_state  


for i in range(1,11): # 1~10 Round 반복
    print('Round',str(i).zfill(2), '>>')
    print("Input State: ", end='')
    printHex(Dec2Hex(new_state)) # Input State 16 진수로 출력
    
    tmp = copy.deepcopy(new_state)  
    tmp1 = SubBytes(tmp)  # SubBytes 
    tmp2 = ShiftRows(tmp1)  # ShiftRows 
    
    if i != 10:  # Round 가 10이 아닐 때 
        tmp3 = MixColumns(tmp2) # MixColumns 
        tmp4 = AddRoundKey(tmp3, roundKey[i])  # AddRoundKey
    else:  # Round 가 10일 때 MixColumns 과정 제외
        tmp4 = AddRoundKey(tmp2, roundKey[i])
        
    new_state = copy.deepcopy(tmp4)

    print("Output State: ", end='')
    printHex(Dec2Hex(new_state)) # Output State 16 진수로 출력
    
    print("Round Key: ", end='')
    printHex(Dec2Hex(roundKey[i]))  # Round Key 16 진수로 출력
    print()

Round 01 >>
Input State: 24 71 B0 A7 26 71 44 88 3D E2 01 11 1B 89 4D 9E 
Output State: 6C B1 C5 5D 44 9E B5 87 13 46 F3 FC BD 35 02 8C 
Round Key: 89 55 B5 CE BD 20 E3 46 8C C2 F1 46 9F 68 A5 C1 

Round 02 >>
Input State: 6C B1 C5 5D 44 9E B5 87 13 46 F3 FC BD 35 02 8C 
Output State: 1A 66 20 2B 90 09 55 CB 15 1D 5A 8C B2 FC B2 3C 
Round Key: CE 53 CD 15 73 73 2E 53 FF B1 DF 15 60 D9 7A D4 

Round 03 >>
Input State: 1A 66 20 2B 90 09 55 CB 15 1D 5A 8C B2 FC B2 3C 
Output State: F6 1B 67 4A 7D 61 09 5C A2 B4 C9 51 B0 B8 45 09 
Round Key: FF 89 85 C5 8C FA AB 96 73 4B 74 83 13 92 0E 57 

Round 04 >>
Input State: F6 1B 67 4A 7D 61 09 5C A2 B4 C9 51 B0 B8 45 09 
Output State: CA D8 D1 4E E5 42 BA 60 48 AF 98 9E BB 71 2D DF 
Round Key: B8 22 DE B8 34 D8 75 2E 47 93 01 AD 54 01 0F FA 

Round 05 >>
Input State: CA D8 D1 4E E5 42 BA 60 48 AF 98 9E BB 71 2D DF 
Output State: 90 2C 9E 49 35 FB FC 39 13 82 61 CB 60 3A ED 47 
Round Key: D4 54 F3 98 E0 8C 86 B6 A7 1F 87 1B F3 1E 88 E1 

Round 06 >>
Input State: 90 2C 9E 49 35 FB FC 39 13 82 61 CB 60 3A ED 47 
Output State: 18 64 5A 8E 0A 68 EF B2 B9 6A D7 10 B5 FB 79 4D 
Round Key: 86 90 0B 95 66 1C 8D 23 C1 03 0A 38 32 1D 82 D9 

Round 07 >>
Input State: 18 64 5A 8E 0A 68 EF B2 B9 6A D7 10 B5 FB 79 4D 
Output State: 01 55 F4 CC 63 24 8A BA F1 3A DE 88 96 62 4D 03 
Round Key: 62 83 3E B6 04 9F B3 95 C5 9C B9 AD F7 81 3B 74 

Round 08 >>
Input State: 01 55 F4 CC 63 24 8A BA F1 3A DE 88 96 62 4D 03 
Output State: 2A 2D 51 87 34 6B 64 A8 D8 A2 CF F8 46 D6 5A 28 
Round Key: EE 61 AC DE EA FE 1F 4B 2F 62 A6 E6 D8 E3 9D 92 

Round 09 >>
Input State: 2A 2D 51 87 34 6B 64 A8 D8 A2 CF F8 46 D6 5A 28 
Output State: 0A 95 2A 16 D9 63 80 76 F1 9F 29 09 3C 35 00 77 
Round Key: E4 3F E3 BF 0E C1 FC F4 21 A3 5A 12 F9 40 C7 80 

Round 10 >>
Input State: 0A 95 2A 16 D9 63 80 76 F1 9F 29 09 3C 35 00 77 
Output State: BC 02 8B D3 E0 E3 B1 95 55 0D 6D F8 E6 F1 82 41 
Round Key: DB F9 2E 26 D5 38 D2 D2 F4 9B 88 C0 0D DB 4F 40

# 복호화

####### Pre-Round

print("Pre-Round >>")
input_state_ = block2state(cipherText)  # Cipher Text 를 State 로 변환
print("Input State: ", end='')
printHex(Dec2Hex(input_state_))  # Cipher Text 를 16 진수로 출력

state = copy.deepcopy(input_state_)  
new_state = AddRoundKey(state, roundKey[10])  # State 와 Pre-RoundKey 를 Add

print("Output State: ", end='')
printHex(Dec2Hex(new_state))  # Pre-Round Output 16 진수로 출력

print("Round Key: ", end='')  
printHex(Dec2Hex(roundKey[10]))   # Pre-Round Round Key 16 진수로 출력

Pre-Round >>
Input State: BC 02 8B D3 E0 E3 B1 95 55 0D 6D F8 E6 F1 82 41 
Output State: 67 FB A5 F5 35 DB 63 47 A1 96 E5 38 EB 2A CD 01 
Round Key: DB F9 2E 26 D5 38 D2 D2 F4 9B 88 C0 0D DB 4F 40 

####### 1 ~ 10 Round

def InvSubBytes(input_state): # Inverse SubBytes 연산
    state = []
    for row in range(4):
        intm_list = []
        for segment in range(4):  
            intm_list.append(InvSbox[input_state[row][segment]])
        state.append(intm_list)
    return state

def InvShiftRows(input_state):  # Inverse Shift Rows 연산
    tmp = [0] * 4   # Right 로 Shift Row 연산 수행
    tmp[0] = [input_state[0][0], input_state[3][1],input_state[2][2],input_state[1][3]] 
    tmp[1] = [input_state[1][0], input_state[0][1],input_state[3][2],input_state[2][3]] 
    tmp[2] = [input_state[2][0], input_state[1][1],input_state[0][2],input_state[3][3]] 
    tmp[3] = [input_state[3][0], input_state[2][1],input_state[1][2],input_state[0][3]]         
    return tmp

def InxMixColumns(state):  # Inverse MixColumns 연산
    out_state = []
    for i in range(4):  # 각 원소 마다 상수 행렬의 역행렬 값과 State의 값 GF 곱셈 연산
        out_col = [0] * 4                           
        out_col[0] = gf(14,state[i][0]) ^ gf(11,state[i][1]) ^ gf(13,state[i][2]) ^ gf(9,state[i][3])
        out_col[1] = gf(9,state[i][0]) ^ gf(14,state[i][1]) ^ gf(11,state[i][2]) ^ gf(13,state[i][3])
        out_col[2] = gf(13,state[i][0]) ^ gf(9,state[i][1]) ^ gf(14,state[i][2]) ^ gf(11,state[i][3])
        out_col[3] = gf(11,state[i][0]) ^ gf(13,state[i][1]) ^ gf(9,state[i][2]) ^ gf(14,state[i][3])
        out_state.append(out_col) 
        
    return out_state  

for i in range(9,-1,-1): # 1~10 Round 반복
    print('Round',str(10-i).zfill(2), '>>')
    print("Input State: ", end='')
    printHex(Dec2Hex(new_state))  # Input State 16 진수로 출력
    tmp = copy.deepcopy(new_state)
    
    tmp1 = InvShiftRows(tmp)  # Inverse ShiftRows
    tmp2 = InvSubBytes(tmp1)  # Inverse SubBytes
    tmp3 = AddRoundKey(tmp2, roundKey[i])   # Add
    
    if i > 0: # 마지막 Round 에 MixColumns 제외
        tmp3 = InxMixColumns(tmp3)
        
    new_state = copy.deepcopy(tmp3)
    
    print("Output State: ", end='')  
    printHex(Dec2Hex(new_state))  # Output State 16 진수로 출력
    
    print("Round Key: ", end='')
    printHex(Dec2Hex(roundKey[i]))  # Round Key 16 진수로 출력
    print()

Round 01 >>
Input State: 67 FB A5 F5 35 DB 63 47 A1 96 E5 38 EB 2A CD 01 
Output State: E5 7F 8A 34 18 3A BE 17 61 F6 D1 C2 5A D8 43 41 
Round Key: E4 3F E3 BF 0E C1 FC F4 21 A3 5A 12 F9 40 C7 80 

Round 02 >>
Input State: E5 7F 8A 34 18 3A BE 17 61 F6 D1 C2 5A D8 43 41 
Output State: 7C 36 1D 7B FB 80 E3 4B A1 AA BF F4 90 FC 7E C4 
Round Key: EE 61 AC DE EA FE 1F 4B 2F 62 A6 E6 D8 E3 9D 92 

Round 03 >>
Input State: 7C 36 1D 7B FB 80 E3 4B A1 AA BF F4 90 FC 7E C4 
Output State: AD 45 0E E3 67 02 B6 19 56 0F BE 37 D5 43 DF CA 
Round Key: 62 83 3E B6 04 9F B3 95 C5 9C B9 AD F7 81 3B 74 

Round 04 >>
Input State: AD 45 0E E3 67 02 B6 19 56 0F BE 37 D5 43 DF CA 
Output State: 60 0F EF A0 96 13 55 3B 7D 80 0B 12 D0 71 B0 1F 
Round Key: 86 90 0B 95 66 1C 8D 23 C1 03 0A 38 32 1D 82 D9 

Round 05 >>
Input State: 60 0F EF A0 96 13 55 3B 7D 80 0B 12 D0 71 B0 1F 
Output State: 74 2C 46 9E D9 79 D8 2F 52 A3 3E D0 EA 61 F4 0B 
Round Key: D4 54 F3 98 E0 8C 86 B6 A7 1F 87 1B F3 1E 88 E1 

Round 06 >>
Input State: 74 2C 46 9E D9 79 D8 2F 52 A3 3E D0 EA 61 F4 0B 
Output State: 42 EF DD 01 FF 8D 6E D6 3A 6C 85 4A E7 AF 01 D1 
Round Key: B8 22 DE B8 34 D8 75 2E 47 93 01 AD 54 01 0F FA 

Round 07 >>
Input State: 42 EF DD 01 FF 8D 6E D6 3A 6C 85 4A E7 AF 01 D1 
Output State: A2 01 BE EB 60 A4 37 F1 59 B0 B7 1F 37 33 FC 64 
Round Key: FF 89 85 C5 8C FA AB 96 73 4B 74 83 13 92 0E 57 

Round 08 >>
Input State: A2 01 BE EB 60 A4 37 F1 59 B0 B7 1F 37 33 FC 64 
Output State: 50 0B 0D 64 1B 5A 77 4C 7D 96 A6 17 7A C8 D5 B0 
Round Key: CE 53 CD 15 73 73 2E 53 FF B1 DF 15 60 D9 7A D4 

Round 09 >>
Input State: 50 0B 0D 64 1B 5A 77 4C 7D 96 A6 17 7A C8 D5 B0 
Output State: 36 A3 7C 0B F7 98 E3 5C 27 A7 E7 C4 AF A3 1B 82 
Round Key: 89 55 B5 CE BD 20 E3 46 8C C2 F1 46 9F 68 A5 C1 

Round 10 >>
Input State: 36 A3 7C 0B F7 98 E3 5C 27 A7 E7 C4 AF A3 1B 82 
Output State: 00 04 12 14 12 04 12 00 0C 00 13 11 08 23 19 19 
Round Key: 24 75 A2 B3 34 75 56 88 31 E2 12 00 13 AA 54 87

 

새벽 4시 56분 ,,, 끝 ,, 

728x90