pseudo code for crc calculator and verifier.mht
来自「cyclic redudndancy check program in mat 」· MHT 代码 · 共 492 行 · 第 1/2 页
MHT
492 行
<w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 3"/>
<w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light List Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 4"/>
<w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light List Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 5"/>
<w:LsdException Locked=3D"false" Priority=3D"60" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Shading Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"61" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light List Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"62" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Light Grid Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"63" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 1 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"64" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Shading 2 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"65" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 1 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"66" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium List 2 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"67" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 1 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"68" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 2 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"69" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Medium Grid 3 Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"70" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Dark List Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"71" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Shading Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"72" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful List Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"73" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" Name=3D"Colorful Grid Accent 6"/>
<w:LsdException Locked=3D"false" Priority=3D"19" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Subtle Emphasis"/>
<w:LsdException Locked=3D"false" Priority=3D"21" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Intense Emphasis"/>
<w:LsdException Locked=3D"false" Priority=3D"31" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Subtle Reference"/>
<w:LsdException Locked=3D"false" Priority=3D"32" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Intense =
Reference"/>
<w:LsdException Locked=3D"false" Priority=3D"33" SemiHidden=3D"false"
UnhideWhenUsed=3D"false" QFormat=3D"true" Name=3D"Book Title"/>
<w:LsdException Locked=3D"false" Priority=3D"37" =
Name=3D"Bibliography"/>
<w:LsdException Locked=3D"false" Priority=3D"39" QFormat=3D"true" =
Name=3D"TOC Heading"/>
</w:LatentStyles>
</xml><![endif]-->
<STYLE>@font-face {
font-family: Cambria Math;
}
@font-face {
font-family: Calibri;
}
@font-face {
font-family: Book Antiqua;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; =
mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; }
P.MsoNormal {
LINE-HEIGHT: 115%; MARGIN: 0in 0in 10pt; FONT-FAMILY: =
"Calibri","sans-serif"; FONT-SIZE: 11pt; mso-style-unhide: no; =
mso-style-qformat: yes; mso-style-parent: ""; mso-pagination: =
widow-orphan; mso-fareast-font-family: Calibri; mso-bidi-font-family: =
"Times New Roman"
}
LI.MsoNormal {
LINE-HEIGHT: 115%; MARGIN: 0in 0in 10pt; FONT-FAMILY: =
"Calibri","sans-serif"; FONT-SIZE: 11pt; mso-style-unhide: no; =
mso-style-qformat: yes; mso-style-parent: ""; mso-pagination: =
widow-orphan; mso-fareast-font-family: Calibri; mso-bidi-font-family: =
"Times New Roman"
}
DIV.MsoNormal {
LINE-HEIGHT: 115%; MARGIN: 0in 0in 10pt; FONT-FAMILY: =
"Calibri","sans-serif"; FONT-SIZE: 11pt; mso-style-unhide: no; =
mso-style-qformat: yes; mso-style-parent: ""; mso-pagination: =
widow-orphan; mso-fareast-font-family: Calibri; mso-bidi-font-family: =
"Times New Roman"
}
.MsoChpDefault {
mso-fareast-font-family: Calibri; mso-style-type: export-only; =
mso-default-props: yes; mso-ascii-font-family: Calibri; =
mso-hansi-font-family: Calibri
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"3074"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1"/>
</o:shapelayout></xml><![endif]--></HEAD>
<BODY style=3D"tab-interval: .5in" lang=3DEN-US>
<DIV class=3DSection1>
<P style=3D"TEXT-ALIGN: center" class=3DMsoNormal align=3Dcenter><B=20
style=3D"mso-bidi-font-weight: normal"><SPAN=20
style=3D"FONT-FAMILY: 'Book Antiqua','serif'">Pseudo Code for CRC =
calculator and=20
Verifier<o:p></o:p></SPAN></B></P>
<P class=3DMsoNormal><o:p> </o:p></P>
<P class=3DMsoNormal>Get input of 7 bit binary data as an array</P>
<P class=3DMsoNormal>Get input of the divisor as an array of length =
n</P>
<P class=3DMsoNormal>Append n-1 0=92s to the data and store this result =
in a=20
variable say =91dividend=92</P>
<P class=3DMsoNormal>Extract first 5 bits of the =91dividend=92 and =
store it in a=20
variable =91A=92 and the remaining bits in another variable =91B=92 </P>
<P class=3DMsoNormal>xor the divisor and =91A=92 and store the result in =
a variable=20
=91result=92</P>
<P class=3DMsoNormal>Keep looping the code within the following braces =
until=20
length of result is n-1</P>
<P class=3DMsoNormal>{</P>
<P style=3D"TEXT-INDENT: 0.5in" class=3DMsoNormal>xor the divisor and =
=91result=92 and=20
store the result in =91result=92</P>
<P style=3D"MARGIN-LEFT: 0.5in" class=3DMsoNormal>keep looping the code =
within the=20
following braces until the 1<SUP>st</SUP> bit of =91result=92 is no more =
a zero and=20
if length of result is not n-1</P>
<P style=3D"MARGIN-LEFT: 0.5in" class=3DMsoNormal>{</P>
<P style=3D"MARGIN-LEFT: 1in" class=3DMsoNormal>Remove the =
1<SUP>st</SUP> bit of=20
=91result=92.</P>
<P style=3D"MARGIN: 0in 0in 0pt 1in" class=3DMsoNormal>If <SPAN=20
style=3D"mso-spacerun: yes"> </SPAN>length of =91result=92 is less =
than the=20
length of =91divisor=92 and =91B=92 isn=92t an empty array then </P>
<P style=3D"MARGIN: 0in 0in 0pt 1in" class=3DMsoNormal>{</P>
<P style=3D"MARGIN: 0in 0in 0pt 1in" class=3DMsoNormal>extract the first =
bit of =91B=92=20
and append it as the last bit of result, remove that 1<SUP>st</SUP> bit =
of =92B=92=20
from =91B=92 as it has been extracted and used and we don=92t want it to =
be extracted=20
and used again.</P>
<P style=3D"MARGIN: 0in 0in 0pt 1in" class=3DMsoNormal>}</P>
<P style=3D"TEXT-INDENT: 0.5in" class=3DMsoNormal>}</P>
<P style=3D"MARGIN-LEFT: 0.5in" class=3DMsoNormal><o:p> </o:p></P>
<P class=3DMsoNormal>}</P>
<P class=3DMsoNormal>The =91result=92 is the calculated CRC in the case =
if data is to=20
be sent</P>
<P class=3DMsoNormal>If the data is to be sent, append the CRC bits at =
the end of=20
data.</P>
<P class=3DMsoNormal>If the data is the received one and it is to be =
checked then=20
the =91result=92 represents whether it is corrupted or not. In this case =
if the=20
=91result=92 is all zeros then the data is free from corruption if the =
result is non=20
zero then the data has gone corrupt on the way.</P></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?