SlideShare a Scribd company logo
1 of 31
3211 Project 
Design: Jiang Yucheng 
Implementation: Zheng Bohan 
Result: Zheng Wenguang
High Level C Programming 
Encryption 
int key=[0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0]; 
int text=[0x43,0x6F,0x6D,0x70,0x41,0x72,0x63,0x68]; //plain text of "CompArch" 
int RN=[0x11,0x90,0x52,0xC8,0xB7,0xCE,0xD4,0x31, 
0xD3,0xCB,0xF1,0xB5,0x73,0xAB,0xBF,0x62]; 
int i,j,k; 
Int mask = 0xF0; 
for (i=0 ; i<length(text) ; i++){ 
for (j=0 ; j <length(key) ; j++){ 
text[i] = bitxor( text[i] , key[j] ); 
k = bitand(text[i],mask); 
text[i]=RN[k]; 
} 
}
High Level C Programming 
Tag 
int key=[0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0]; 
int text=[0x43,0x6F,0x6D,0x70,0x41,0x72,0x63,0x68]; //plain text of "CompArch" 
int mask=0x80; 
int tag = 0x00; 
int text_temp , j=0; 
Int N = length(text)/8 , R = length (text) % 8 ; 
for(i=0 ; i<N ; i++){ 
for(cnt=0 ; cnt<8 ; cnt++) { 
if (bitand(key[j],mask) == 0x80) 
text_temp = bit_shift_left( text[i] , 1 ); 
else 
text_temp = text[i]; 
tag = bitxor(text_temp,tag); 
bit_shift_left(key[j] , 1); } 
if(j==7){ 
j = 0; } 
else{ 
j++;} 
} 
for(i=0 ; i<R ; i++){ 
if (bitand(key[j],mask) == 0x80) 
text_temp = bit_shift_left( text[i] , 1 ); 
else 
text_temp = text[i]; 
tag = bitxor(text_temp,tag); 
bit_shift_left(key[j] , 1); 
}
ISA 
Op - Code rs rt rd 
Op – Code rs rt offset 
Op - Code rs rt instance 
Op - Code rt/rd 
Add 
Sub 
Xor 
And 
Beq 
Bne 
Load 
Store 
Addi 
shift
Assembly Language 
Encryption 
(0) addi $s1 , $s0 , F # $s1 = 15 
(1) addi $s1 , $s1 , 9 # $s1 the pointer of the plaintext (the head of the stack is 24) 
(2) load $s2 , $s1 , 0 # $s2 the current char pointer 
(3) load $s15 , $s2 , 0 # $s15 current char 
(4) add $s3 , $s15 ,$s0 # $s3 working char which will be overwriten during encryption 
loop 
(5) addi $s4 , $s0 , 15 # $s4 key pointer (one element before because of the loop 
starts with an increment) 
(6) load $s6 , $s1 , 2 # $s6 = 15 the mask to get the index of RN table stored in 
data_memory(26) 
(7) load $s7 , $s1 , 3 # $s7 = F0 last key value need to be used in bne instruction 
(8) load $s8 , $s1 , 4 # $s8 = 10 which stores the "encryption" tag address for 
loop 
(9) load $14, $1 , 1 # $s14 stores the pointer of cipher text 
--data preparation
Assembly Language 
Encryption 
(10) addi $s4 , $s4 , 1 # increase the key pointer jump addr 
(11) load $s5 , $s4 , 0 # $5 get the 16bit key value from the data memo 
(12) xor $s9 , $s3 , $s5 # $s9 <= $s3 xor $s5 
(13) and $s10, $s9 , $s6 # mask and get the rn table index 
(14) load $s11, $s10, $s0 # $11 one loop result 
(15) add $s3 , $s11, $s0 # overwrite the working char for next loop 
(16) add $s12, $s5 , $s0 # tmp reg $s12 stores the current key for bne judgement 
(17) bne $s12, $s7 , $s8 # if it is NOT the last key ,continue loop 
(18) no op 
(20) addi $2 , $2 , 1 # plaintext pointer move ahead 
(21) load $15 , $2 , 0 # $15 current char 
(22) add $3 , $15 ,$0 # $3 working char which will be overwriten during encryption loop 
(23) addi $14 ,$14 , 1 
(24) addi $4 , $0 , 15 # let the key pointer point to the head of the key again 
(25) bne $15 , $0 , $8 # make a definate not equal to jump--Process 0 24 Char 
pointer 
Working 
char 
Key 
pointer 
Current 
key value 
0x000F 
(mask) 
Last key 
Value 
Jump addr Xor 
result 
RN 
index 
One loop 
result 
Current 
key 
Cipher 
pointer 
Current 
char
Assembly Language 
Tag 
(29) load $s2, $s1, 1 # $s2 loads mem(25) 
(30) load $s11, $s1, 5 # $s11 loads mem(29) ~1$B 
(31) load $s12, $s1, 6 # $s12 loads mem(30) ~2$C 
(32) load $s5, $s1, 7 # $s5 loads mem(31) mask 
(33) addi $s7, $s1, 8 # $s7=32 
(34) load $s7, $s7, 0 # $s7 loads mem(32) 
(35) addi $s14, $s1, 9 # $s14=33 
(36) load $s14, $s14, 0 # $s14 loads mem(33) 
(37) add $s8, $s0, $s0 #$s8=0 
(38) add $s10, $s0, $s0 #$s10=0 
(39) add $s13, $s0, $s0 #$S13=0 
(40) add $s9, $s0, $s0 #$s9=0 
(41) addi $s9, $s0, 8 #$s9=8 
(42) add $s1, $s0, $s0 #$s1=0 
(43) addi $s1, $s0, 15 #$s1=15 
(44) addi $s1, $s1, 1 #$s1=16 
--data preparation
Assembly Language 
(45) load $s3, $s1, 0 #$S3 loads mem(16) key $S3 jump addr(2) load next key 
(46) load $s4, $s2, 0 #$s4 loads mem(134) text $s4 jump addr(1) load next cipher 
(47) beq $s0, $s4, $s13 #beq text to null 
(48) no op 
(49) add $s6, $s3, $s5 #$s6 result of mask of key 
(50) bne $s6, $s5, $s7 #bne result of AND to mask 
(51) no op 
(52) shift $s7, $s7, 1 #$s4 shift left 
(53) xor $s8, $s4, $s8 #$s4 xor $s8 => $s8 jump addr(3) 
(54) shift $s3, $s3, 1 #$s3 key shift left 
(55) addi $s2, $s2, 1 #move text pointer 
(56) addi $s10, $s10, 1 #cnt for text +1 
(57) bne $s10, $s9, $s11 
(58) no op 
0 Key 
Cipher 
pointer 
pointer 
(59) add $s10, $s0, $s0 #reset cnt for text 
(60) addi $s1, $s1, 1 #move key pointer 
(61) addi $s13, $s13, 1 #cnt for key +1 
(62) bne $s13, $s9, $s12 #bne cot for key to 8 
(63) no op 
(64) sub $s1, $s9, $s1 #key pointer points to 16 
(65) add $s13, $s0, $s0 #reset cnt for key 
(66) bne $s13, $s9, $s12 #bne cnt for key to 8 
(67) no op 
Current 
key 
Current 
cipher text 
0x80 
(mask) 
Mask 
result 
Addr 3 
Xor 
result 
8 Text 
count 
Addr 1 
Addr 2 Key count Addr of 
stop
Instruction Count 
Encryption: 10 + 9Nx8 + 7N 
Tag: 16+ 13N + 6 (N/8)+ 4(N/64) (n/8 & n/64 
round up) 
Total : 26+93N 
(if input is 100 plain text) 9326 instructions
The Original Design 
:-/ 
1. ALU is just an adder 
2. The pc can only run sequentially 
3. Every memory is not big enough
The Overall Design 
1. Change the adder to ALU 
2. Program Counter can jump 
3. Expand the memory
Special Feature 1 : ALU 
1. New Input for hierarchical operation code 
2. New out put for branch logical
Special Feature 2 : Branch 
1. New input and output in Reg File for branch addressing 
2. Branch logical in the top level between component ALU&PC 
3. 7bit MUX to decide sequentially running or jump
Clock Design 
1. Brach operation or memory load? Definitely LOAD! 
2. Cycle Time = 1.5 + 0.5 + 1.5 + 1.5 + 2 + 3 + 1.5 + 0.5*(7+4+16) 
= 25ns
High Level Instruction Exec
Questions ! Fire Away !
Results 
• VHDL model
Results 
• VHDL model 
plain text are stored from memory(34)
Results 
• Explanation of simulation 
Encryption 
key points 
1.How to achieve the 
loop for encryption of 
one char. 
2.How to jump to the 
next char. 
3.how to jump to tag
Results 
• Explanation of simulation 
Tag 
key points 
1. How to determine "shift" or "no-shift" 
2. How to use the second 8-bit key 
3. How to reuse the key
Results 
• Verification of the correctness of results 
Encryption 
1.initialization 
2.Encryption loop for one char 
3.Encryption loop for next char 
4.jump to tag
Results 
initialization
Results 
• Verification of the correctness of results 
Encryption loop for one char.
Results 
• Verification of the correctness of results 
Encryption for the next char
Results 
• Verification of the correctness of results 
jump to tag
Results 
• Verification of the correctness of results 
Tag 
1.No shift part 
2.Shift part 
3.The next 8-bit key 
4.Count for 8-bit key
Results 
• Verification of the correctness of results 
no-shift part
Results 
• Verification of the correctness of results 
shift part
Results 
• Verification of the correctness of results 
The next 8-bit key
Results 
• Verification of the correctness of results 
Count for 8-bit key
THANK YOU

More Related Content

What's hot

The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robinAbdullah Al Naser
 
Data structures cs301 power point slides lecture 03
Data structures   cs301 power point slides lecture 03Data structures   cs301 power point slides lecture 03
Data structures cs301 power point slides lecture 03Nasir Mehmood
 
Understanding storage class using nm
Understanding storage class using nmUnderstanding storage class using nm
Understanding storage class using nmmohamed sikander
 
Network security
Network securityNetwork security
Network securitybabyangle
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)vinay arora
 
Double linked list
Double linked listDouble linked list
Double linked listSayantan Sur
 
Circular linked list
Circular linked listCircular linked list
Circular linked listSayantan Sur
 
Sorting programs
Sorting programsSorting programs
Sorting programsVarun Garg
 
Single linked list
Single linked listSingle linked list
Single linked listSayantan Sur
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C LanguageRAJWANT KAUR
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Alex Penso Romero
 

What's hot (20)

Unix Programs
Unix ProgramsUnix Programs
Unix Programs
 
C# - What's next
C# - What's nextC# - What's next
C# - What's next
 
The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
 
Data structures cs301 power point slides lecture 03
Data structures   cs301 power point slides lecture 03Data structures   cs301 power point slides lecture 03
Data structures cs301 power point slides lecture 03
 
Understanding storage class using nm
Understanding storage class using nmUnderstanding storage class using nm
Understanding storage class using nm
 
Network security
Network securityNetwork security
Network security
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
Networking Core Concept
Networking Core ConceptNetworking Core Concept
Networking Core Concept
 
Double linked list
Double linked listDouble linked list
Double linked list
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Sorting programs
Sorting programsSorting programs
Sorting programs
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Struct examples
Struct examplesStruct examples
Struct examples
 
C++ file
C++ fileC++ file
C++ file
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 

Viewers also liked

13.Anton-Position-Security-Considerations-23June2015[1]
13.Anton-Position-Security-Considerations-23June2015[1]13.Anton-Position-Security-Considerations-23June2015[1]
13.Anton-Position-Security-Considerations-23June2015[1]Anton Kaska
 
GwirVol priority groups
GwirVol priority groupsGwirVol priority groups
GwirVol priority groupswalescva
 
Screenshots for Front Cover
Screenshots for Front CoverScreenshots for Front Cover
Screenshots for Front CoverShobyone
 
Presentatie Menzis at Co-Creation Awards 2012: Team topzorg
Presentatie Menzis at Co-Creation Awards 2012: Team topzorgPresentatie Menzis at Co-Creation Awards 2012: Team topzorg
Presentatie Menzis at Co-Creation Awards 2012: Team topzorgMarijn Kieft
 
4.2 the user experience ak
4.2 the user experience ak4.2 the user experience ak
4.2 the user experience akarthurkrull
 
대중서사장르의 이해
대중서사장르의 이해대중서사장르의 이해
대중서사장르의 이해준혁 이
 
주간학습3월25
주간학습3월25주간학습3월25
주간학습3월25moonjunu
 
소셜 네트워크서비스(Sns)와 대학생 사회의 변화
소셜 네트워크서비스(Sns)와 대학생 사회의 변화소셜 네트워크서비스(Sns)와 대학생 사회의 변화
소셜 네트워크서비스(Sns)와 대학생 사회의 변화Jinhee Ahn
 
젤리요가 피피티파이널_김승원, 이서현, 정선지
젤리요가 피피티파이널_김승원, 이서현, 정선지젤리요가 피피티파이널_김승원, 이서현, 정선지
젤리요가 피피티파이널_김승원, 이서현, 정선지서현 이
 
사례 연구를 통한 온라인 커머스 uxui 방향성 검토
사례 연구를 통한 온라인 커머스 uxui 방향성 검토사례 연구를 통한 온라인 커머스 uxui 방향성 검토
사례 연구를 통한 온라인 커머스 uxui 방향성 검토Billy Choi
 
Introduction to the crees research programme
Introduction to the crees research programmeIntroduction to the crees research programme
Introduction to the crees research programmecrees foundation
 
UDK Level design portfolio (PvP TDM) [Praha]
UDK Level design portfolio (PvP TDM) [Praha]UDK Level design portfolio (PvP TDM) [Praha]
UDK Level design portfolio (PvP TDM) [Praha]Kyeong-su Song
 
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구Inyong Lee
 
NDC 2013 - 초심자를 배려하는 레벨 디자인
NDC 2013 - 초심자를 배려하는 레벨 디자인NDC 2013 - 초심자를 배려하는 레벨 디자인
NDC 2013 - 초심자를 배려하는 레벨 디자인용태 이
 
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105NAVER D2 STARTUP FACTORY
 
Curso de Raciocínio Analítico p/ Funpresp - Jud
Curso de Raciocínio Analítico p/ Funpresp - JudCurso de Raciocínio Analítico p/ Funpresp - Jud
Curso de Raciocínio Analítico p/ Funpresp - JudEstratégia Concursos
 
Curso de Auditoria p/ concurso TCE-PA 2016
Curso de Auditoria p/ concurso TCE-PA 2016Curso de Auditoria p/ concurso TCE-PA 2016
Curso de Auditoria p/ concurso TCE-PA 2016Estratégia Concursos
 

Viewers also liked (18)

13.Anton-Position-Security-Considerations-23June2015[1]
13.Anton-Position-Security-Considerations-23June2015[1]13.Anton-Position-Security-Considerations-23June2015[1]
13.Anton-Position-Security-Considerations-23June2015[1]
 
GwirVol priority groups
GwirVol priority groupsGwirVol priority groups
GwirVol priority groups
 
Screenshots for Front Cover
Screenshots for Front CoverScreenshots for Front Cover
Screenshots for Front Cover
 
Presentatie Menzis at Co-Creation Awards 2012: Team topzorg
Presentatie Menzis at Co-Creation Awards 2012: Team topzorgPresentatie Menzis at Co-Creation Awards 2012: Team topzorg
Presentatie Menzis at Co-Creation Awards 2012: Team topzorg
 
4.2 the user experience ak
4.2 the user experience ak4.2 the user experience ak
4.2 the user experience ak
 
대중서사장르의 이해
대중서사장르의 이해대중서사장르의 이해
대중서사장르의 이해
 
주간학습3월25
주간학습3월25주간학습3월25
주간학습3월25
 
소셜 네트워크서비스(Sns)와 대학생 사회의 변화
소셜 네트워크서비스(Sns)와 대학생 사회의 변화소셜 네트워크서비스(Sns)와 대학생 사회의 변화
소셜 네트워크서비스(Sns)와 대학생 사회의 변화
 
젤리요가 피피티파이널_김승원, 이서현, 정선지
젤리요가 피피티파이널_김승원, 이서현, 정선지젤리요가 피피티파이널_김승원, 이서현, 정선지
젤리요가 피피티파이널_김승원, 이서현, 정선지
 
사례 연구를 통한 온라인 커머스 uxui 방향성 검토
사례 연구를 통한 온라인 커머스 uxui 방향성 검토사례 연구를 통한 온라인 커머스 uxui 방향성 검토
사례 연구를 통한 온라인 커머스 uxui 방향성 검토
 
Introduction to the crees research programme
Introduction to the crees research programmeIntroduction to the crees research programme
Introduction to the crees research programme
 
UDK Level design portfolio (PvP TDM) [Praha]
UDK Level design portfolio (PvP TDM) [Praha]UDK Level design portfolio (PvP TDM) [Praha]
UDK Level design portfolio (PvP TDM) [Praha]
 
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구
지유명차/티쿱스토어 전문취급점 운영 제안 - 보이차/우롱차/자사호/차도구
 
NDC 2013 - 초심자를 배려하는 레벨 디자인
NDC 2013 - 초심자를 배려하는 레벨 디자인NDC 2013 - 초심자를 배려하는 레벨 디자인
NDC 2013 - 초심자를 배려하는 레벨 디자인
 
Guidance & counseling report
Guidance & counseling reportGuidance & counseling report
Guidance & counseling report
 
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105
[D2SF] 글로벌 스타트업을 위한 아주 쉬운 법무 기초_오세은_20160105
 
Curso de Raciocínio Analítico p/ Funpresp - Jud
Curso de Raciocínio Analítico p/ Funpresp - JudCurso de Raciocínio Analítico p/ Funpresp - Jud
Curso de Raciocínio Analítico p/ Funpresp - Jud
 
Curso de Auditoria p/ concurso TCE-PA 2016
Curso de Auditoria p/ concurso TCE-PA 2016Curso de Auditoria p/ concurso TCE-PA 2016
Curso de Auditoria p/ concurso TCE-PA 2016
 

Similar to Encryption and Decryption using Tag Design

FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...AntareepMajumder
 
MIPS_Programming.pdf
MIPS_Programming.pdfMIPS_Programming.pdf
MIPS_Programming.pdfXxUnnathxX
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksSegmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksDavid Evans
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxSonu62614
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 Cececourse
 
HacknamStyle Plaid CTF write-up
HacknamStyle Plaid CTF write-upHacknamStyle Plaid CTF write-up
HacknamStyle Plaid CTF write-upvanhoefm
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2Abdul Haseeb
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPSPrasenjit Dey
 
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016Codemotion
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate CompilersFunctional Thursday
 
Trible data encryption standard (3DES)
Trible data encryption standard (3DES)Trible data encryption standard (3DES)
Trible data encryption standard (3DES)Ahmed Mohamed Mahmoud
 
Arduino coding class part ii
Arduino coding class part iiArduino coding class part ii
Arduino coding class part iiJonah Marrs
 
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdf
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdfIT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdf
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdfDhanuskarSankar1
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhDIVYA SINGH
 
C:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 BC:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 Bececourse
 

Similar to Encryption and Decryption using Tag Design (20)

Mips
MipsMips
Mips
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
MIPS_Programming.pdf
MIPS_Programming.pdfMIPS_Programming.pdf
MIPS_Programming.pdf
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksSegmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
 
Chapter 2 Part2 C
Chapter 2 Part2 CChapter 2 Part2 C
Chapter 2 Part2 C
 
HacknamStyle Plaid CTF write-up
HacknamStyle Plaid CTF write-upHacknamStyle Plaid CTF write-up
HacknamStyle Plaid CTF write-up
 
strings
stringsstrings
strings
 
Python programming workshop session 2
Python programming workshop session 2Python programming workshop session 2
Python programming workshop session 2
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPS
 
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
Trible data encryption standard (3DES)
Trible data encryption standard (3DES)Trible data encryption standard (3DES)
Trible data encryption standard (3DES)
 
20141106 asfws unicode_hacks
20141106 asfws unicode_hacks20141106 asfws unicode_hacks
20141106 asfws unicode_hacks
 
Arduino coding class part ii
Arduino coding class part iiArduino coding class part ii
Arduino coding class part ii
 
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdf
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdfIT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdf
IT8761-SECURITY LABORATORY-590519304-IT8761 security labmanual.pdf
 
C program
C programC program
C program
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
C:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 BC:\Fakepath\Chapter 2 Part2 B
C:\Fakepath\Chapter 2 Part2 B
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Encryption and Decryption using Tag Design

  • 1. 3211 Project Design: Jiang Yucheng Implementation: Zheng Bohan Result: Zheng Wenguang
  • 2. High Level C Programming Encryption int key=[0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0]; int text=[0x43,0x6F,0x6D,0x70,0x41,0x72,0x63,0x68]; //plain text of "CompArch" int RN=[0x11,0x90,0x52,0xC8,0xB7,0xCE,0xD4,0x31, 0xD3,0xCB,0xF1,0xB5,0x73,0xAB,0xBF,0x62]; int i,j,k; Int mask = 0xF0; for (i=0 ; i<length(text) ; i++){ for (j=0 ; j <length(key) ; j++){ text[i] = bitxor( text[i] , key[j] ); k = bitand(text[i],mask); text[i]=RN[k]; } }
  • 3. High Level C Programming Tag int key=[0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0]; int text=[0x43,0x6F,0x6D,0x70,0x41,0x72,0x63,0x68]; //plain text of "CompArch" int mask=0x80; int tag = 0x00; int text_temp , j=0; Int N = length(text)/8 , R = length (text) % 8 ; for(i=0 ; i<N ; i++){ for(cnt=0 ; cnt<8 ; cnt++) { if (bitand(key[j],mask) == 0x80) text_temp = bit_shift_left( text[i] , 1 ); else text_temp = text[i]; tag = bitxor(text_temp,tag); bit_shift_left(key[j] , 1); } if(j==7){ j = 0; } else{ j++;} } for(i=0 ; i<R ; i++){ if (bitand(key[j],mask) == 0x80) text_temp = bit_shift_left( text[i] , 1 ); else text_temp = text[i]; tag = bitxor(text_temp,tag); bit_shift_left(key[j] , 1); }
  • 4. ISA Op - Code rs rt rd Op – Code rs rt offset Op - Code rs rt instance Op - Code rt/rd Add Sub Xor And Beq Bne Load Store Addi shift
  • 5. Assembly Language Encryption (0) addi $s1 , $s0 , F # $s1 = 15 (1) addi $s1 , $s1 , 9 # $s1 the pointer of the plaintext (the head of the stack is 24) (2) load $s2 , $s1 , 0 # $s2 the current char pointer (3) load $s15 , $s2 , 0 # $s15 current char (4) add $s3 , $s15 ,$s0 # $s3 working char which will be overwriten during encryption loop (5) addi $s4 , $s0 , 15 # $s4 key pointer (one element before because of the loop starts with an increment) (6) load $s6 , $s1 , 2 # $s6 = 15 the mask to get the index of RN table stored in data_memory(26) (7) load $s7 , $s1 , 3 # $s7 = F0 last key value need to be used in bne instruction (8) load $s8 , $s1 , 4 # $s8 = 10 which stores the "encryption" tag address for loop (9) load $14, $1 , 1 # $s14 stores the pointer of cipher text --data preparation
  • 6. Assembly Language Encryption (10) addi $s4 , $s4 , 1 # increase the key pointer jump addr (11) load $s5 , $s4 , 0 # $5 get the 16bit key value from the data memo (12) xor $s9 , $s3 , $s5 # $s9 <= $s3 xor $s5 (13) and $s10, $s9 , $s6 # mask and get the rn table index (14) load $s11, $s10, $s0 # $11 one loop result (15) add $s3 , $s11, $s0 # overwrite the working char for next loop (16) add $s12, $s5 , $s0 # tmp reg $s12 stores the current key for bne judgement (17) bne $s12, $s7 , $s8 # if it is NOT the last key ,continue loop (18) no op (20) addi $2 , $2 , 1 # plaintext pointer move ahead (21) load $15 , $2 , 0 # $15 current char (22) add $3 , $15 ,$0 # $3 working char which will be overwriten during encryption loop (23) addi $14 ,$14 , 1 (24) addi $4 , $0 , 15 # let the key pointer point to the head of the key again (25) bne $15 , $0 , $8 # make a definate not equal to jump--Process 0 24 Char pointer Working char Key pointer Current key value 0x000F (mask) Last key Value Jump addr Xor result RN index One loop result Current key Cipher pointer Current char
  • 7. Assembly Language Tag (29) load $s2, $s1, 1 # $s2 loads mem(25) (30) load $s11, $s1, 5 # $s11 loads mem(29) ~1$B (31) load $s12, $s1, 6 # $s12 loads mem(30) ~2$C (32) load $s5, $s1, 7 # $s5 loads mem(31) mask (33) addi $s7, $s1, 8 # $s7=32 (34) load $s7, $s7, 0 # $s7 loads mem(32) (35) addi $s14, $s1, 9 # $s14=33 (36) load $s14, $s14, 0 # $s14 loads mem(33) (37) add $s8, $s0, $s0 #$s8=0 (38) add $s10, $s0, $s0 #$s10=0 (39) add $s13, $s0, $s0 #$S13=0 (40) add $s9, $s0, $s0 #$s9=0 (41) addi $s9, $s0, 8 #$s9=8 (42) add $s1, $s0, $s0 #$s1=0 (43) addi $s1, $s0, 15 #$s1=15 (44) addi $s1, $s1, 1 #$s1=16 --data preparation
  • 8. Assembly Language (45) load $s3, $s1, 0 #$S3 loads mem(16) key $S3 jump addr(2) load next key (46) load $s4, $s2, 0 #$s4 loads mem(134) text $s4 jump addr(1) load next cipher (47) beq $s0, $s4, $s13 #beq text to null (48) no op (49) add $s6, $s3, $s5 #$s6 result of mask of key (50) bne $s6, $s5, $s7 #bne result of AND to mask (51) no op (52) shift $s7, $s7, 1 #$s4 shift left (53) xor $s8, $s4, $s8 #$s4 xor $s8 => $s8 jump addr(3) (54) shift $s3, $s3, 1 #$s3 key shift left (55) addi $s2, $s2, 1 #move text pointer (56) addi $s10, $s10, 1 #cnt for text +1 (57) bne $s10, $s9, $s11 (58) no op 0 Key Cipher pointer pointer (59) add $s10, $s0, $s0 #reset cnt for text (60) addi $s1, $s1, 1 #move key pointer (61) addi $s13, $s13, 1 #cnt for key +1 (62) bne $s13, $s9, $s12 #bne cot for key to 8 (63) no op (64) sub $s1, $s9, $s1 #key pointer points to 16 (65) add $s13, $s0, $s0 #reset cnt for key (66) bne $s13, $s9, $s12 #bne cnt for key to 8 (67) no op Current key Current cipher text 0x80 (mask) Mask result Addr 3 Xor result 8 Text count Addr 1 Addr 2 Key count Addr of stop
  • 9. Instruction Count Encryption: 10 + 9Nx8 + 7N Tag: 16+ 13N + 6 (N/8)+ 4(N/64) (n/8 & n/64 round up) Total : 26+93N (if input is 100 plain text) 9326 instructions
  • 10. The Original Design :-/ 1. ALU is just an adder 2. The pc can only run sequentially 3. Every memory is not big enough
  • 11. The Overall Design 1. Change the adder to ALU 2. Program Counter can jump 3. Expand the memory
  • 12. Special Feature 1 : ALU 1. New Input for hierarchical operation code 2. New out put for branch logical
  • 13. Special Feature 2 : Branch 1. New input and output in Reg File for branch addressing 2. Branch logical in the top level between component ALU&PC 3. 7bit MUX to decide sequentially running or jump
  • 14. Clock Design 1. Brach operation or memory load? Definitely LOAD! 2. Cycle Time = 1.5 + 0.5 + 1.5 + 1.5 + 2 + 3 + 1.5 + 0.5*(7+4+16) = 25ns
  • 18. Results • VHDL model plain text are stored from memory(34)
  • 19. Results • Explanation of simulation Encryption key points 1.How to achieve the loop for encryption of one char. 2.How to jump to the next char. 3.how to jump to tag
  • 20. Results • Explanation of simulation Tag key points 1. How to determine "shift" or "no-shift" 2. How to use the second 8-bit key 3. How to reuse the key
  • 21. Results • Verification of the correctness of results Encryption 1.initialization 2.Encryption loop for one char 3.Encryption loop for next char 4.jump to tag
  • 23. Results • Verification of the correctness of results Encryption loop for one char.
  • 24. Results • Verification of the correctness of results Encryption for the next char
  • 25. Results • Verification of the correctness of results jump to tag
  • 26. Results • Verification of the correctness of results Tag 1.No shift part 2.Shift part 3.The next 8-bit key 4.Count for 8-bit key
  • 27. Results • Verification of the correctness of results no-shift part
  • 28. Results • Verification of the correctness of results shift part
  • 29. Results • Verification of the correctness of results The next 8-bit key
  • 30. Results • Verification of the correctness of results Count for 8-bit key