12
12
///
13
13
. align 4
14
14
encrypt:
15
- push {r4 , r5 , r6 , r7 , LP } // step #1_en - Save R4 , R5 , R6 , R7 , and LR
15
+ push {r4 , r5 , r6 , r7 , LR } // step #1_en - Save R4 , R5 , R6 , R7 , and LR
16
16
mov r4 , # 0 // step #2_en - Set register R4 to 0
17
17
mov r5 , # 0 // step #3_en - Set register R5 to 0
18
18
@@ -21,11 +21,11 @@ EN_WHL_R5_LT_R1:
21
21
blGE r5 , EN_END_WHL_R5_LT_R1 // step #5_en - if R5 greater than or equal to R1 , branch to EN_END_WHL_R5_LT_R1
22
22
ldrb r6 , r0 [ r5 ] // step #6_en - load byte into register R6 , the contents of R0 [ R5 ]
23
23
ldrb r7 , r2 [ r4 ] // step #7_en - load byte into register R7 , the contents of R2 [ R4 ]
24
- OR r6 , r6 , r7 // step #8_en - exclusive or R6 and R7 , storing result in R6
24
+ XOR r6 , r7 // step #8_en - exclusive or R6 and R7 , storing result in R6
25
25
AND r7 , r5 , # 255 // step #9_en - use bitwise AND with R5 and # 255 to cast R5's value as char instead of int , store in R7
26
26
add r6 , r6 , r7 // step #10_en - add R6 and R7 , storing result in R6
27
27
strb r6 , r0 [ r5 ] // step #11_en - store byte in R6 to R0 [ R5 ]
28
- inc r4 // step #12_en - increment R4 by one
28
+ inc r4 , # 1 // step #12_en - increment R4 by one
29
29
EN_IF_R4_GE_R3:
30
30
cmp r4 , r3 // step #13_en - compare R4 and R3 in this order of the registers
31
31
movGE r4 , # 0 // step #14_en - do conditional execution , move if greater than or equal , into R4 the value # 0
@@ -56,8 +56,8 @@ DE_WHL_R5_LT_R1:
56
56
ldrb r6 , r0 [ r5 ] // step #6_de - load byte into register R6 , the contents of R0 [ R5 ]
57
57
AND r7 , r5 , # 255 // step #7_de - use bitwise AND with R5 and # 255 to cast R5's value as char instead of int , store in R7
58
58
sub r6 , r6 , r7 // step #8_de - subtract R6 and R7 , storing result in R6
59
- ldbr r7 , r2 [ r4 ] // step #9_de - load byte into register R7 , the contents of R2 [ R4 ]
60
- OR r6 , r6 , r7 // step #10_de - exclusive or R6 and R7 , storing result in R6
59
+ ldrb r7 , r2 [ r4 ] // step #9_de - load byte into register R7 , the contents of R2 [ R4 ]
60
+ XOR r6 , r7 // step #10_de - exclusive or R6 and R7 , storing result in R6
61
61
strb r6 , r0 [ r5 ] // step #11_de - store byte in R6 to R0 [ R5 ]
62
62
inc r4 // step #12_de - increment R4 by one
63
63
DE_IF_R4_GE_R3:
0 commit comments