> BDA` 0bjbj 1$,c68LLLLL{!{!{!////G/267h:6{!Y!"{!{!{!6LL
6!!!{!
LL/!{!/!!-//L@P9d#!
./360c6.`:!F:0//://p{!{!!{!{!{!{!{!66!
{!{!{!c6{!{!{!{!d
COE 205, Term 061
Computer Organization & Assembly ProgrammingProgramming Assignment# 3
Due date: Wednesday, Dec. 13, 2006
You are required to write an 8086 assembly program to implement a pseudo random generator using Liner Feedback Shift Register (LFSR). An example of an 8-bit LFSR is shown below:
Two important characteristics of an LFSR are the Feedback Polynomial, which determines the FFs that are XORed to compute the shifted bit, and the seed which determines the initial content of the FFs. Depending on the Feedback polynomial, the LFSR can generate a maximal-length sequence without repetition, or it may not. The seed can be any number other than 0.
The 8-bit LFSR shown above is a maximal-length i.e. it is guaranteed to generate a random sequence in the range from 1 to 255 before it repeats again.
The Feedback polynomial for the above LFSR can be represented as 10001101. Note that 1 indicates that there is feedback connection, while 0 indicates that there is no feedback connection.
Write a procedure, RAND8, that implements an 8-bit pseudo random generator. The procedure should be given the Feedback polynomial, and the seed, and it should generate the next random number.
Write a program that generates all 8-bit primitive polynomials. Note that there are 255 different polynomials. Your program should print the number of primitive polynomials found and print the primitive polynomials themselves.
Write a procedure, ToOneDigit, that converts a multiple digit 8-bit number to a single digit number. This is achieved by adding the individual digits of this number to get another integer. The same process is repeated to the obtained integer. This process is repeated until the number becomes a single digit. For exampe: 219=2+1+9=12=1+2=3. Thus, the procedure converts 219 to 3.
Write a procedure, ToOneCharacter, that converts a string of characters to a single character by XORing the ASCII code of these characters. If the result is 0, then make it 1, otherwise keep it as is.
Write a program that asks the user to enter a password, which is a string of maximum 30 charcaters. Use procedure ToOneCharacter to convert the password into a single character to be used as the seed of the random number generator. Then, ask the user to enter a string of characters. Then, encrypt the string using RAND8 and ToOneDigit procedures as follows. Store all the primitive polynomials in a table called Primitives. For each character, use the procedure RAND8 to generate a random number using the current seed and the next primitive polynomial in the table Primitives. Then, use procedure ToOneDigit to convert the generated random number into a single digit number, N. The next available character in the string is encrypted by XORing the least significant 4-bits of the ASCII code of the character with N. For example, assume the character to be encrypted is A=41H and the random number is 123d. Then, the random number is converted to a single digit number N=6d. Then, the character is encrypted by XORing 1 XOR 6 and the encrypted character will be 47h=G. To decrypt the character, the encrypted character 47H=G, will be XORed with the same corresponding single digit number N=6 obtained from the same random number used for encryption i.e. 123 and this will generate the original character 41H=A, as 1 XOR 7 =6. As an example show the encryption of the string This is the last Assignment!!. Then, rerun your program giving it the encrypted string and it should correctly decrypt it to This is the last Assignment!!. Try this with a seed of 10101010.
The solution should be well organized and your programs should be well documented. Submit a soft copy of your solution in a zip file. The soft copy should include a Readme file indicating the file names containing the solution and whether it works or not. The Readme file should also contain your name and ID. Submit both source code files (i.e. .asm) and the executable files (i.e. .exe).
@VXY[enopquvx}~ 5 6 : H
O
j
k
!9;g·¬·͙{{{whHUh|jhq/CJUhkhq/h^=h]}wh]}wCJaJhPfC5CJ\aJh3N5CJ\aJh|e5CJ\aJh\T5CJ\aJh]}w5CJ\aJh]^CJaJhHUCJaJh\TCJaJh]}wCJaJhOICJaJ.[2 3 4 5 7 8 9 :
<
$
&F
a$gd
q$
&F
a$gd\$
&F
a$gd\T$a$gd'N$a$gd|gdq/gd]^gd\Tgdkgh
$,6JS
.<FHj$>KKLMN\px*O|Ⱦ̺ȲhQ\zhh_Xh&h&5\h&hhMJhMJ5\hMJhMJhHU5\h\ThHUh]}wh|hkh'NF
ILgi
CD`B_`ǹ~shh|CJaJhh]^5CJ\aJh]^56CJ\]aJ hP'h]^56CJ\]aJh_X56CJ\]aJh56CJ\]aJh]}w56CJ\]aJh
qhHU5\h
q5\h
qh
q5\h
qhHUh&h"
gd$^a$gd]^^gd_X$
&F
a$gd_X/ 0&P/ =!"#$%@@@Normal_HmHnHsH tH u\@\Heading 1,Question$$@&a$CJKHaJR@R Heading 2$$x@&^a$CJaJuR@R Heading 3$
&F<@&5CJ\aJX@X Heading 4$
&F<@&56CJ\]aJP@P Heading 5
&F<@&CJOJQJaJV@V Heading 6
&F<@&6CJOJQJ]aJH@H Heading 7
&F<@&OJQJN@N Heading 8
&F<@&6]OJQJV @V Heading 9
&F<@&6CJOJQJ]aJDADDefault Paragraph FontViVTable Normal :V44
la(k(No List6O6 Dspace-NI
`LOLDspace$dhx*$`a$CJaJ6O6Author$a$CJaJO"Figuren$
&Fh>T0Figurea$F>@2FTitle$<a$5CJ KH\aJ&P$@BPEnvelope Address
$^CJaJOR
References$
&F
hhdhx>Th[]^h`a$CJaJHC@bHBody Text Indent
`CJOr
Definitionh
&F>T
0Definition`DOD Sspace.NI$
a$CJaJOQ Questionso@d>T8@Q..^@`OListai>T8h()^`O Question1c
&F@& >T2B@2 Body TextCJ:P@:Body Text 2CJaJ$[2345789:<
00000000000000000
0
0
0
0
000000g
8ae@-dV(
T nd
d#"Z ld
cldZ l
blB` h|
#l
4
hH
4
|ZB
SDH
`
#
B
B
@ `B
c$D@ZB
SDZ |
a|B
B
W|`B
c$DW`B
c$Dkt
##"4
4
@ ZB
SD@ZB
SD`B
+
c$DdTB
1
CD<[PTB
4
CD^xn PD
8#"nbB2
9
PDTB
:
CDPDTB
;B
CD@@xn PD
G#"(nbB2
H
PDTB
I
CDPDTB
JB
CD@@ZB
K
SD;ZB
M
SD;ZB
NB
SD^<^TB
QB
CD^^ZB
WB
SDZ<ZZB
[
SDlxn PD
\#"nbB2
]
PDTB
^
CDPDTB
_B
CD@@ZB
`
SDOB
S ?5d$d4[:
pflI`KhH]:()!"}8b-z2?/=b2d#\b
dS..@0^`056CJOJQJo(Q..@P^`P56CJOJQJo(()@P0^P`0.@
0^
`0)@0^`0()@0^`0()@0^`0()@`0^``0()@00^0`0()^`5o(.hh^h`56.808^8`0o(()^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L.0 0^`0o(()^`.0 L ^ `L.^`.xx^x`.0HLH^H`L.^`.^`.0L^`L.0^`05o(()^`o(.@P^`P56CJOJQJo(()@P0^P`0.@
0^
`0)@0^`0()@0^`0()@0^`0()@`0^``0()@00^0`0() 88^8`5o(()`P^`P56CJOJQJo(()`P0^P`0.`
0^
`0)`0^`0()`0^`0()0`0^`0()``0^``0()0`00^0`0()@h^`56CJOJQJo(()
Id#\-d#\l?/=pf
dS)!] hX > q/PfCOIMJ'N\T
q]}wQ\z^=|eHU|]^3N\&k_X&@HP LaserJet 1200 Series PCLNe01:winspoolHP LaserJet 1200 Series PCLHP LaserJet 1200 Series PCL4C 4dXXA4DINU"4J4HP LaserJet 1200 Series PCL4C 4dXXA4DINU"4J4@@UnknownGz Times New Roman5Symbol3&z ArialM`@Traditional Arabic3z Times"h*fFgCcSA
SA
!r4d 2QHX(?q/2,KING FAHD UNIVERSITY OF PETROLEUM & MINERALSHassan R. Baradaaimane0 Oh+'0, <H
ht
0KING FAHD UNIVERSITY OF PETROLEUM & MINERALSHassan R. BaradaNormal.dotaimane12Microsoft Office Word@
@>3}@xy2@kd#SA
՜.+,0$
px
4-KING FAHD UNIVERSITY OF PETROLEUM & MINERALSTitle
!"#$%&'()*+,-./02345678:;<=>?@CRoot Entry F$d#E1Table:WordDocument1$SummaryInformation(1DocumentSummaryInformation89CompObjq
FMicrosoft Office Word Document
MSWordDocWord.Document.89q