'scode to be add a configured string' SKEY key string (former 8-bit valid) Public SUB DES_ENCODE (byref scode () as byte, byval skey as string, byref Breturn () AS BYTE) Attribute des_encode.vb_description = "encryption Scode:明文 16 credit string SKEY: Key text, the first 8 valid Breturn: Ciphertext 16 Brand "
DIM TEMPKEY () AS BYTE 'Storage Key DIM BINKEY (63) AS BYTE '64 Binary Binary Original Key DIM Keypc_1 (55) AS BYTE' Store 56-bit key
DIM Tempcode (7) AS BYTE 'Store 8 original plaintext Dim Tempreturn (7) as byte' stores 8-bit cizes
Dim bincode (63) AS BYTE 'Store 64-bit DIM CODEIP (63) AS BYTE' Storage IP Displacement Result DIM CODEE (47) AS BYTE 'E Database DIM CODEP (31) AS BYTE' P Transform results DIM RETS (47 AS BYTE 'S Box Operation 32 - bit DIM S (7) AS BYTE' S Box Operation 8 Results Dim Codes1 (5) AS BYTE: DIM CODES2 (5) AS BYTE: DIM CODES3 (5) AS BYTE: DIM CODES4 (5) AS BYTEDIM CODES5 (5) AS BYTE: DIM CODES6 (5) AS BYTE: DIM CODES7 (5) AS BYTE: DIM CODES8 (5) AS BYTE
DIM L0 (31) AS BYTE: DIM R0 (31) AS BYTE: DIM R1 (31) AS BYTEDIM L2 (31) AS BYTE: DIM R2 (31) AS BYTEDIM L3 (31) AS BYTE: DIM R3 (31) AS BYTE: DIM R4 (31) AS BYTEDIM L5 (31) AS BYTE: DIM R5 (31) AS BYTEDIM L6 (31) AS BYTE: DIM R6 (31) AS BYTEDIM L7 (31) AS BYTE: DIM R7 (31) AS BYTE: DIM R8 (31) AS BYTEDIM L9 (31) AS BYTE: DIM R9 (31) AS BYTEDIM L10 (31) AS BYTE: DIM R10 (31) AS BYTE: DIM R11 (31) AS BYTE: DIM R12 (31) AS BYTEDIM L13 (31) AS BYTE: DIM R13 (31) AS BYTE: DIM R13 (31) AS BYTEDIM L14 (31) AS BYTE: DIM R14 (31) AS BYTEDIM L15 (31) AS BYTE: DIM R15 (31) AS BYTEDIM L16 (31) AS BYTE: DIM R16 (31) AS BYTE
DIM C0 (27) AS BYTE: DIM D0 (27) AS BYTE '16 Key DIM C1 (27) AS BYTE: DIM D1 (27) AS BYTEDIM C2 (27) AS BYTE: DIM D2 (27) AS BYTE: DIM C3 (27) AS BYTE: DIM C4 (27) AS BYTE: DIM D4 (27) AS BYTE: DIM C5 (27) AS BYTE: DIM D5 (27) AS BYTE: DIM C6 (27) AS BYTE: DIM C7 (27) AS BYTE: DIM D8 (27) AS BYTE: DIM D8 (27) AS BYTE: DIM D8 (27) AS BYTE: DIM D8 (27) AS BYTE: DIM C9 (27 AS BYTE: DIM D9 (27) AS BYTE: DIM C10 (27) AS BYTE: DIM D10 (27) AS BYTE: DIM C11 (27) AS BYTE: DIM D11 (27) AS BYTE: DIM C12 (27) AS BYTE: DIM C13 (27) AS BYTE: DIM D13 (27) AS BYTE: DIM C14 (27) AS BYTE: DIM D14 (27) AS BYTE: DIM C15 (27) AS BYTE: DIM D15 (27) AS BYTE: DIM C16 (27) AS BYTE: DIM D16 (27) AS BYTE: DIM C_D (55) AS BYTE 'CN, DN Merge Required Storage
DIM K1 (47) AS BYTE: DIM K3 (47) AS BYTE: DIM K4 (47) AS BYTE: DIM K5 (47) AS BYTE: DIM K6 (47) AS BYTE: DIM K7 (47) AS BYTE: DIM K10 (47) AS BYTE: DIM K11 (47) AS BYTE: DIM K12 (47) AS BYTE: DIM K12 (47) AS BYTE: DIM K12 (47) AS BYTE: DIM K13 (47 AS BYTE: DIM K14 (47) AS BYTE: DIM K15 (47) AS BYTE: DIM K16 (47) AS BYTE:
DIM I AS INTEGERDIM J AS INTEGER
'Take the first 8 bytes of the key Tempkey = strconv (SKEY, VBFROMUNICODE) Redim Preserve Tempkey (7)
For i = 0 to 7 binkey (i * 8 0) = (Tempkey (i) and & h80) / & h80 binkey (i * 8 1) = (TempKey (i) and & h40) / & H40 binkey (i * 8 2) = (TempKey (i) and & H20) / & H20 binkey (i * 8 3) = (Tempkey (i) and & H10) / & H10 binkey (i * 8 4) = (TempKey (i) and & h8) / & H8 Binkey (i * 8 5) = (Tempkey (i) and & H4) / & H4 Binkey (i * 8 6) = (Tempkey (i) and & H2) / & H2 Binkey (i * 8 7) = (Tempkey (i) And & H1) / & H1Next
'Pc_1 conversion for i = 0 to 55 keypc_1 (i) = binkey (pc_1 (i)) NEXT' generates C0, D0FOR I = 0 to 27 c0 (i) = keypc_1 (i) d0 (i) = keypc_1 (i 28) NEXT
'********************************************************** ** k1 'generates C1, D1FOR I = 0 to 26 C1 (i) = c0 (i LSI (1)) D1 (i) = d0 (i LSI (1)) NEXTC1 (27) = c0 (0) D1 (27) = d0 (0)
'Combination C1, D1 is C_DFOR I = 0 to 27 c_d (i) = C1 (I) C_D (i 28) = D1 (i) NEXT
'Pc_2 conversion, generate k1for i = 0 to 47 k1 (i) = c_d (pc_2 (i)) Next
'********************************************************** ** K2 'Generates C2, D2FOR I = 0 to 26 C2 (i) = C1 (i LSI (2)) D2 (i) = D1 (i LSI (2)) NextC2 (27) = C1 (0) D2 (27) = d1 (0)
'Combination C2, D2 into c_dfor i = 0 to 27 c_d (i) = C2 (i) c_d (i 28) = D2 (i) Next
'Pc_2 conversion, generate K2FOR I = 0 to 47 k2 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** K3 'Generates C3, D3for I = 0 to 25 C3 (i) = C2 (i LSI (3)) D3 (i) = D2 (i LSI (3)) NextC3 (26) = C2 (0) D3 (26) = D2 (0) C3 (27) = C2 (1) D3 (27) = d2 (1)
'Combination C3, D3 into c_dfor i = 0 to 27 c_d (i) = C3 (i) c_d (i 28) = D3 (i) Next
'Pc_2 conversion, generate K3for I = 0 to 47 k3 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** k4 'generates C4, D4FOR I = 0 to 25 C4 (i) = C3 (i LSI (4)) D4 (i) = D3 (i LSI (4)) NextC4 (26) = C3 (0) D4 (26) = D3 (0) C4 (27) = C3 (1) D4 (27) = D3 (1)
'Combination C4, D4 into c_dfor i = 0 to 27 c_d (i) = C4 (i) c_d (i 28) = D4 (i) Next
'PC_2 conversion, generate K4FOR I = 0 to 47 k4 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** k5 'generates C5, D5FOR I = 0 to 25 C5 (i) = C4 (i LSI (5)) D5 (i) = D4 (i LSI (5)) NextC5 (26) = C4 (0) D5 (26) = D4 (0) C5 (27) = C4 (1) D5 (27) = D4 (1) 'Combination C5, D5 is C_DFOR I = 0 to 27 c_d (i) = C5 (I) C_D ( I 28) = D5 (i) Next
'Pc_2 conversion, generate K5FOR i = 0 to 47 k5 (i) = c_d (pc_2 (i)) Next
'********************************************************** ** k6 'Generate C6, D6for I = 0 to 25 C6 (i) = C5 (i LSI (6)) D6 (i) = D5 (i LSI (6)) Nextc6 (26) = C5 (0) D6 (26) = D5 (0) C6 (27) = C5 (1) D6 (27) = D5 (1)
'Combination C6, D6 into c_dfor i = 0 to 27 c_d (i) = C6 (i) c_d (i 28) = D6 (i) Next
'Pc_2 conversion, generate K6for I = 0 to 47 k6 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** K7 'Generates C7, D7FOR I = 0 to 25 C7 (i) = C6 (i LSI (7)) D7 (i) = D6 (i LSI (7)) Nextc7 (26) = C6 (0) D7 (26) = d6 (0) C7 (27) = C6 (1) D7 (27) = D6 (1)
'Combination C7, D7 C_Dfor I = 0 to 27 c_d (i) = c7 (i) c_d (i 28) = D7 (i) Next
'PC_2 conversion, generate K7for I = 0 to 47 k7 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** k8 'generates C8, D8FOR I = 0 to 25 C8 (i) = C7 (i LSI (8)) D8 (i) = D7 (i LSI (8)) NextC8 (26) = C7 (0) D8 (26) = D7 (0) C8 (27) = C7 (1) D8 (27) = D7 (1)
'Combination C8, D8 into c_dfor i = 0 to 27 c_d (i) = C8 (i) c_d (i 28) = D8 (i) Next
'Pc_2 conversion, generate K8for I = 0 to 47 k8 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** K9 'Generates C9, D9for I = 0 to 26 C9 (i) = C8 (i LSI (9)) D9 (i) = D8 (i LSI (9)) NextC9 (27) = C8 (0) D9 (27) = D8 (0) 'combination C9, D9 into c_dfor i = 0 to 27 c_d (i) = c9 (i) c_d (i 28) = D9 (i) Next
'Pc_2 conversion, generate K9for I = 0 to 47 k9 (i) = c_d (pc_2 (i)) Next
'********************************************************** ** K10 'Generates C10, D10for I = 0 to 25 C10 (i) = C9 (i LSI (10)) D10 (i) = D9 (i LSI (10)) NEXTC10 (26) = C9 (0) D10 (26) = D9 (0) C10 (27) = C9 (1) D10 (27) = D9 (1)
'Combination C10, D10 into c_dfor i = 0 to 27 c_d (i) = C10 (i) c_d (i 28) = D10 (i) Next
'Pc_2 conversion, generate K10FOR I = 0 to 47 k10 (i) = c_d (PC_2 (I)) NEXT
'********************************************************** ** k11 'generates C11, D11for I = 0 to 25 C11 (i) = C10 (i LSI (11)) D11 (i) = D10 (i LSI (11)) NEXTC11 (26) = C10 (0) D11 (26) = D10 (0) C11 (27) = C10 (1) D11 (27) = D10 (1)
'Combination C11, D11 C_dfor I = 0 to 27 c_d (i) = C11 (i) C_D (i 28) = D11 (i) Next
'Pc_2 conversion, generate k11for i = 0 to 47 k11 (i) = c_d (pc_2 (i)) Next
'********************************************************** ** k12 'generates C12, D12FOR I = 0 to 25 C12 (i) = C11 (i LSI (12)) D12 (i) = D11 (i LSI (12)) NextC12 (26) = C11 (0) D12 (26) = D11 (0) C12 (27) = C11 (1) D12 (27) = D11 (1)
'Combination C12, D12 C_Dfor I = 0 to 27 c_d (i) = C12 (I) C_D (i 28) = D12 (i) Next
'Pc_2 conversion, generate K12FOR i = 0 to 47 k12 (i) = C_D (PC_2 (I)) Next
'********************************************************** ** K13 'Generates C13, D13for I = 0 to 25 C13 (i) = C12 (i LSI (13)) D13 (i) = D12 (I LSI (13)) NextC13 (26) = C12 (0) D13 (26) = D12 (0) C13 (27) = C12 (1) D13 (27) = D12 (1) 'combination C13, D13 is C_DFOR I = 0 to 27 c_d (i) = C13 (i) c_d ( I 28) = D13 (i) Next
'PC_2 conversion, generate K13for I = 0 to 47 k13 (i) = c_d (PC_2 (I)) Next
'********************************************************** ** K14 'Generate C14, D14for I = 0 to 25 C14 (i) = C13 (i LSI (14)) D14 (I) = D13 (i LSI (14)) NextC14 (26) = C13 (0) D14 (26) = D13 (0) C14 (27) = C13 (1) D14 (27) = D13 (1)
'Combination C14, D14 into c_dfor i = 0 to 27 c_d (i) = C14 (I) C_D (i 28) = D14 (i) Next
'Pc_2 conversion, generate K14FOR i = 0 to 47 k14 (i) = C_D (PC_2 (I)) Next
'********************************************************** ** k15 'generates C15, D15FOR I = 0 to 25 C15 (i) = C14 (i LSI (15)) D15 (i) = D14 (i LSI (15)) NextC15 (26) = C14 (0) D15 (26) = D14 (0) C15 (27) = C14 (1) D15 (27) = D14 (1)
'Combination C15, D15 into c_dfor i = 0 to 27 c_d (i) = C15 (i) C_D (i 28) = D15 (i) NEXT
'PC_2 conversion, generate K15FOR i = 0 to 47 k15 (i) = C_D (PC_2 (I)) Next
'********************************************************** ** K16 'Generates C16, D16FOR I = 0 to 26 C16 (i) = C15 (i LSI (16)) D16 (i) = D15 (i LSI (16)) NextC16 (27) = C15 (0) D16 (27) = D15 (0)
'Combination C16, D16 into C_DFOR I = 0 to 27 c_d (i) = C16 (I) C_D (i 28) = D16 (i) NEXT
'Pc_2 conversion, generate K16FOR I = 0 to 47 k16 (i) = C_D (PC_2 (I)) Next
'********************************************************** **********************************************
'Extending the number of places to 8 multiple IF (Ubound (Scode) 1) MOD 8> 0 THEN Redim Preserve Scode ((Ubound (Scode 1) / 8 1) * 8 - 1)' Definition Back Cixin length Redim Breturn (Ubound (Scode))
For j = 0 to ubound (scode) STEP 8 'encryption process' Number of 8-bit encryption CopyMemory Tempcode (0), Scode (j), 8 for i = 0 to 7 bincode (i * 8 0) = (Tempcode I) And & H80) / & H80 Bincode (i * 8 1) = (Tempcode (i) and & H40) / & H40 Bincode (i * 8 2) = (Tempcode (i) and & H20) / & H20 Bincode (i * 8 3) = (Tempcode (i) and & h10) / & H10 bincode (i * 8 4) = (Tempcode (i) and & h8) / & h8 bincode (i * 8 5) = (Tempcode (i) and & h4) / & H4 bincode (i * 8 6) = (Tempcode (i) and & H2) / & H2 bincode (i * 8 7) = (Tempcode (i) and & h1) / & h1 next 'ip replacement for i = 0 to 63 Codeip (i) = bincode (IP (i)) Next 'segment for i = 0 to 31 l0 (i) = codeip (i) r0 (i) = codeip (i 32) Next' for first iterative for I = 0 to 47 CODEE (I) = R0 (e (i)) 'After e-conversion expansion, the 32-bit becomes 48-bit Codee (i) = Codee (i) XOR K1 (i)' and K1 Do not carry the addition of the operation next 'points 8 group for i = 0 to 5 CODES1 (i) = codeE (i) CODES2 (i) = Codee (i 6) CODES3 (I) = CODEE (i 12) CODES4 (i) = CODEE (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = codeE (i 30) CODES7 (i) = Codee (i 36) CODES8 (I) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4
CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 Codes3 (1) * 8) S (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4 ) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2 , CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = S (i) and & h8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / & h2 rets * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i))' generates L1, R1 R1 (i) = l0 ( I) XOR CODEP (i) L1 (i) = R0 (i) Next 'for second iterative for i = 0 to 47 CODEE (i) = r1 (e (i))' E-converted, from 32 bits to 48-bit Codee (i) = Codee i) xor k2 (i) 'and K2 bit by position non-carrying operation next' points 8 group for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 ( I) = CODEE (i) = Codee (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = CODEE (i 30) CODES7 (i) = Codee (i
36) CODES8 (I) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3 * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 Codes4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S ( 5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 ( CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & h8 rets (i * 4 1) = ( S (i) and & h4) / & H4 RETS (i * 4 2) = (s (i) and & h2) / & H2 RETS (i * 4 3) = (s (i) and & h1) / & h1 next for i = 0 to 31 'P Transform CODEP (I) = RETS (p (i))' Generate L2, R2 R2 (I) = L1 (i) XOR CODEP (i) L2 (I) = R1 (I) Next ' The third iterative for i = 0 to 47 CODEE (I) = R2 (e (i)) 'After e-conversion expansion, the 32-bit becomes 48-bit Codee (i) = Codee (i) xor k3 (i)'
With K3 Bouting Corporation NEXT 'Pieces 8 Groups for i = 0 To 5 CODES1 (i) = CODEE (i) Codes2 (i) = CODEE (i 6) CODES3 (i) = CODEE (i 12 ) CODES4 (I) = CODEE (i 18) CODES5 (i) = codee (i 24) CODES6 (i) = codee (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box calculation, get 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2 * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8 S (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S (6) = S7 (CODES7 (5) CODES7 ( 0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4 ) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) And & H8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 RETS (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3 ) = (S (i) and & h1) / & h1 next for i = 0 to 31 '
P conversion CODEP (i) = RETS (p (i)) "Generates L3, R3 R3 (I) = L2 (i) XOR CODEP (I) L3 (I) = R2 (i) Next 'for the fourth iterative for I = 0 to 47 CODEE (I) = R3 (e (i)) 'After e-conversion expansion, the 32-bit becomes 48-bit Codee (i) = Codee (i) XOR K4 (I)' and K4 Do not carry the addition of the addition of NEXT '分 8 group for i = 0 to 5 CODES1 (i) = Codee (i) CODES2 (i) = Codee (i 6) CODES3 (i) = Codee (i 12) Codes4 (i) = CODEE (i) = CODEE (i) = CODEE (i) = codee (i 30) CODES7 (i) = codee (i 36) CODES8 (i) = codee (i 42 NEXT 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8 ) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, Codes4 (4) CODES4 (3) * 2 Codes4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1 ) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) '
S-box computing 32-bit results for i = 0 to 7 RETS (i * 4 0) = (S (i) and & h8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 RETS (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3) = (s (i) and & h1) / & h1 next for i = 0 to 31 'P conversion CODEP I) = RETS (p (i)) 'generates L4, R4 R4 (I) = L3 (i) xor CODEP (i) L4 (I) = R3 (i) NEXT' Performing the fifth iterative for i = 0 TO 47 CODEE (I) = R4 (e (i)) 'After e-conversion, it is changed from 32-bit to 48-bit Codee (i) = Codee (i) XOR K5 (i)' and K5 bit position without carrying the operation Next 'points 8 group for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = CODEE (i 12) Codes4 (i) = codee (i 18) CODES5 (I) = CODEE (i) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = Codee (i 42) Next 's Box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2 , CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) S (3) = S4 (CODES4 (5) CODES4 (0) * 2, Codes4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4)
CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2 ) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & h8 rets (i * 4 1 ) = (S (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3) = (s (i) and & h1) / & h1 Next for i = 0 to 31 'P Transform CODEP (i) = RETS (p (i))' Generate L5, R5 R5 (I) = L4 (i) XOR CODEP (I) L5 (I) = R4 (i) Next 'performs the sixth iteration for i = 0 to 47 CODEE (I) = R5 (e (i))' After e-conversion expansion, the 32-bit becomes 48-bit Codee (I) = Codee (i) xor k6 ( I) 'and K6 bit by position without carrying the addition of NEXT' 分 8 group for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = Codee I 12) CODES4 (I) = Codee (i 18) CODES5 (i) = Codee (i 24) CODES6 (I) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 ( CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4
CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 Codes4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S (5 ) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box operation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & H8 rets (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / & H2 RETS (i * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'p conversion CODEP (i) = RETS (p (i))' generates L6, R6 R6 ( I) = L5 (i) xor codep (i) L6 (i) = r5 (i) next 'performing the seventh iteration for i = 0 to 47 codee (i) = r6 (e (i))' After e-conversion expansion, the 32-bit becomes 48 code (i) = code (i) xor k7 (i) 'and K7 bitwise does not carry the addition operation next' points 8 group for i = 0 to 5 CODES1 (i ) = CODEE (i) CODES2 (i) = codee (i 6) CODES3 (i) = codee (i 12) CODES4 (i) = codee (i 18) CODES5 (i) = codee (i 24) CODES6 (I) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 ( CODES1 (5)
CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4 ) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, Codes4 (4) CODES4 (3 * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S Box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (S (i) and & h8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3) = (s (i) And & H1) / & H1 Next for i = 0 to 31 'P Transform CODEP (i) = RETS (p (i))' Generate L7, R7 R7 (I) = L6 (i) XOR CODEP (I) L7 (i) = R6 (i) Next 'Performing the eighth iterative for i = 0 to 47 CODEE (I) = R7 (e (i))' After e-conversion expansion, the 32-bit becomes 48-bit Codee (I) = Codee I) xor k8 (i) 'with K8 bit by position does not carry the addition of NEXT' score 8 group for i = 0 to 5 CODES1 (i) = Codee (i) CODES2 (i) = Codee (i
6) CODES3 (I) = CODEE (i 12) CODES4 (i) = CODEE (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = CODEE (i 30) CODES7 (i) = CODEE (i) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4 ) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3 * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 Codes5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S ( 6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 ( CODES8 (5) CODES8 (0) * 2, COD ES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S Box Operation 32 Result for i = 0 TO 7 RETS (i * 4 0) = (S (i) AND H8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 RETS (i * 4 2) = (s (i) and & h2) / & h2 rets (i * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i))' generates L8, R8 R8 (I) = L7 (I ) XOR CODEP (i) L8 (i) =
R7 (i) Next 'performs the 9th iterative for i = 0 to 47 CODEE (I) = R8 (e (i))' After e-transform expansion, the 32-bit becomes 48-bit Codee (I) = Codee (I ) Xor k9 (i) 'with K9 bit by position, non-carrying operation Next' points 8 group for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i ) = CODEE (i) = codee (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = codee (i 30) CODES7 (i) = codeE (i 36) CODES8 (I) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3 * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 Codes4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1 ) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S Box Operation 32 Bits Result for i = 0 to 7 RETS (i * 4 0) = (S (i) and & h8) / & h8 rets (i * 4 1) =
(S (i) and & h4) / & H4 RETS (i * 4 2) = (S (i) and & H2) / & H2 RETS (i * 4 3) = (s (i) and & h1) / & H1 Next for I = 0 to 31 'P Transform CODEP (i) = RETS (p (i))' Generate L9, R9 R9 (I) = L8 (i) XOR CODEP (I) L9 (I) = R8 (i) Next ' Performing the 10th Ieration for I = 0 to 47 CODEE (I) = R9 (e (i)) 'Extraced to expand, from 32-bit to 48-bit Codee (i) = Codee (i) xor k10 (i) 'And K10 positions do not carry the addition of the addition of the operation next' points 8 group for i = 0 to 5 CODES1 (i) = codeE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = codee (i 12) CODES4 (I) = CODEE (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = CODEE (i 30) CODES7 (i) = Codee (i 36) CODES8 (i) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 ( 2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) S (3) = S4 (CODES4 (5) CODES4 ( 0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4)
CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & h8 rets i * 4 1) = (s (i) and & h4) / & H4 RETS (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3) = (s (i) AND & H1) / & H1 Next for i = 0 to 31 'P Transform CODEP (i) = RETS (p (i))' Generate L10, R10 R10 (I) = L9 (i) XOR CODEP (I) L10 (i) = R9 (i) Next 'Performing the 11th iteration for i = 0 to 47 CODEE (i) = r10 (e (i))' E-converted, becoming 48-bit Codee (I) = Codee by 32 bits I) xor k11 (i) 'and K11 bit by position without carrying the addition of NEXT' score 8 group for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 ( I) = CODEE (i) = Codee (i 18) CODES5 (i) = CODEE (i 24) CODES6 (i) = CODEE (i 30) CODES7 (i) = Codee (i 36) CODES8 (i) = CODEE (i 42) NEXT 'S box operation, get 8 numbers s (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 ( 1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4
CODES4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S (6 = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S Box Operation 32 Result for i = 0 TO 7 RETS (i * 4 0) = (s (i) and & h8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (s (s) I) AND & H2) / & H2 RETS (i * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i))' generation L11, R11 R11 (I) = L10 (i) XOR CODEP (I) L11 (I) = R10 (i) Next 'Performing the 12th iterative for i = 0 to 47 CODEE (I) = R11 (e (i) ) 'After e-conversion, it becomes 48-bit Codee (i) = CodeE (i) xor k12 (i)' and K12 bit by bit, 8 sets For i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i) = Codee (i 12) CODES4 (i) = Codee (i 18) Codes5 ( I) = CODEE (i) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 's box operation, get 8 Number S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1 ) =
S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) ) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0 * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) s (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 retrs (i * 4 0) = (s (i) and & h8) / & h8 rets (i * 4 1) = (S (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / & H2 rets (i * 4 3) = (s (i) and & h1) / & h1 next For i = 0 to 31 'p conversion CODEP (i) = RETS (p (i )) 'Generate L12, R12 R12 (I) = L11 (i) XOR CODEP (I) L12 (I) = R11 (i) Next' performs the 13th iteration for i = 0 to 47 CODEE (I) = R12 ( E (i)) 'After e-conversion, it is converted from 32-bit to 48-bit Codee (i) = Codee (i) XOR K13 (i)' with K13 bit by position, notifying the addition, NEXT 'score 8 group for i = 0 TO 5 CODES1 (I) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = CODEE (i 12) CODES4 (i) = Codee (i 18) CODES5 (i) =
CODEE (i) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box operation, 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) s (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) S (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 ( 4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, Codes6 (4) CODES6 ( 3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S Box Operation 32 Result for i = 0 T O 7 RETS (i * 4 0) = (s (i) and & h8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = ( S (i) and & h2) / & h2 rets (i * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i)) 'Generate L13, R13 R13 (I) = L12 (i) XOR CODEP (i) L13 (i) = R12 (I) NEXT' for the first 14th iterative for i = 0 to 47 CODEE (I) =
R13 (e (i)) 'After e-conversion expansion, the 32-bit becomes 48-bit Codee (i) = Codee (i) xor k14 (i)' and K14 bits do not carry the addition operation next 'points 8 sets for i = 0 to 5 CODES1 (i) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = CODEE (i 12) CODES4 (i) = Codee (i 18) CODES5 (i ) = CODEE (i) = Codee (i 30) CODES7 (i) = codee (i 36) CODES8 (i) = CODEE (i 42) Next 'S box operation, 8 Number S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) S (3) = S4 (CODES4 (5) CODES4 ( 0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4 ) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3 * 2 CODES7 (2) * 4 CODES7 (1) * 8) S (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & h8 rets (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (s (i) and & h2) / &
H2 RETS (i * 4 3) = (s (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i)) "Generate L14, R14 R14 (I ) = L13 (i) XOR CODEP (i) L14 (i) = R13 (i) Next 'performs the 15th iteration for i = 0 to 47 CODEE (I) = R14 (e (i))' After e-conversion expansion 32-bit to 48 code (i) = code (i) xor k15 (i) 'with K15 bit position does not carry the addition of the operation next' points 8 group for i = 0 to 5 CODES1 (i) = Codee I) CODES2 (I) = CODEE (i 6) CODES3 (i) = CODEE (i 12) CODES4 (i) = CODEE (i 18) CODES5 (i) = Codee (i 24) CODES6 (i) = CODEE (i 30) CODES7 (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box calculation, get 8 numbers S (0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2, CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) s (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 ( 4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 Codes4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4) CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) S ( 5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) s (6) = S7 ( CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2) * 4 CODES7 (1) * 8) s (7) =
S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 TO 7 RETS (i * 4 0) = (S (i) and & H8) / & H8 RETS (i * 4 1) = (s (i) and & h4) / & H4 rets (i * 4 2) = (S (i) and & h2) / & H2 RETS (i * 4 3) = (S (i) and & h1) / & H1 next for i = 0 to 31 'P conversion CODEP (i) = RETS (p (i) ) 'Generate L15, R15 R15 (I) = L14 (i) xor CODEP (i) L15 (I) = R14 (i) NEXT' performs the sixth iteration for i = 0 to 47 CODEE (I) = R15 (e (i)) 'After e-conversion, it becomes 48-bit Codee (i) = CodeE (i) xor k16 (i)' and K16 bit by position, non-input To 5 CODES1 (I) = CODEE (i) CODES2 (i) = CODEE (i 6) CODES3 (i) = CODEE (i 12) CODES4 (i) = CODEE (i 18) CODES5 (i) = Codee (i 24) CODES6 (i) = CODEE (i) = CODEE (i 36) CODES8 (i) = CODEE (i 42) Next 'S box calculation, 8 numbers S ( 0) = S1 (CODES1 (5) CODES1 (0) * 2, CODES1 (4) CODES1 (3) * 2 CODES1 (2) * 4 CODES1 (1) * 8) S (1) = S2 (CODES2 (5) CODES2 (0) * 2 , CODES2 (4) CODES2 (3) * 2 CODES2 (2) * 4 CODES2 (1) * 8) S (2) = S3 (CODES3 (5) CODES3 (0) * 2, CODES3 (4) CODES3 (3) * 2 CODES3 (2) * 4 CODES3 (1) * 8) s (3) = S4 (CODES4 (5) CODES4 (0) * 2, CODES4 (4) CODES4 (3) * 2 CODES4 (2) * 4 CODES4 (1) * 8) S (4) = S5 (CODES5 (5) CODES5 (0) * 2, CODES5 (4)
CODES5 (3) * 2 CODES5 (2) * 4 CODES5 (1) * 8) s (5) = S6 (CODES6 (5) CODES6 (0) * 2, CODES6 (4) CODES6 (3) * 2 CODES6 (2) * 4 CODES6 (1) * 8) S (6) = S7 (CODES7 (5) CODES7 (0) * 2, CODES7 (4) CODES7 (3) * 2 CODES7 (2 ) * 4 CODES7 (1) * 8) s (7) = S8 (CODES8 (5) CODES8 (0) * 2, CODES8 (4) CODES8 (3) * 2 CODES8 (2) * 4 CODES8 (1) * 8) 'S box calculation 32-bit results for i = 0 to 7 RETS (i * 4 0) = (s (i) and & h8) / & H8 RETS (i * 4 1) = (s (s) I) AND & H4) / & H4 RETS (i * 4 2) = (S (i) and & H2) / & H2 RETS (i * 4 3) = (s (i) and & h1) / & h1 next for i = 0 TO 31 'P Transform CODEP (I) = RETS (p (i))' Generates L11, R11 R16 (I) = L15 (i) XOR CODEP (I) L16 (I) = R15 (I) Next for i = 0 To 31 bincode (i) = l16 (i) Bincode (i) NEXT for i = 0 to 63 codeip (i) = bincode (ip_1 (i)) Next for i = 0 to 7 Tempreturn ( I) = Codeip (i * 8 0) * & H80 Tempreturn (i) = Tempr ETURN (I) CODEIP (i * 8 1) * & H40 Tempreturn (i) = Tempreturn (i) Codeip (i * 8 2) * & H20 Tempreturn (i) = Tempreturn (i) Codeip (i * 8 3) * & H10 Tempreturn (i) = Tempreturn (i) Codeip (i * 8 4) * & H8 Tempreturn (i) = Tempreturn (i) Codeip (i * 8 5) * & H4 Tempreturn (i) = Tempreturn (I) Codeip (i * 8 6) * & H2 Tempreturn (i) = Tempreturn (i) Codeip (i * 8 7) * &