2018-2019-1 20175206 "Information security system design basis" the second week of learning summary

2018-2019-1 20175206 "Information security system design basis" the second week of learning summary

And conversion of binary information

Byte: computer smallest addressable memory unit of
virtual memory: machine-level program memory as a very large array of bytes

Hexadecimal

十进制:D=dndn-1...d1d0.d-1...d-m(m,n为正整数)
二进制:B=bnbn-1...b1b0.b-1...b-m(m,n为正整数)
八进制:O=onon-1...o1o0.o-1...0-m(m,n为正整数)
十六进制:H=hnhn-1...h1h0.h-1...h-m(m,n为正整数),在C语言中以0x或0X开头的数字常量为十六进制的值

Base conversion:

十进制转换R进制:整数部分除以R,商为权值,直至商为0并以下至上排列;小数部分不断乘R记录结果的整数部分并以上至下排列
二进制转换八进制:每三位为一个八进制,不足在最高位补0
二进制转换十六进制:每四位为一个十六进制,不足在最高位补0
对于一个字长为w位的机器,虚拟地址的范围为0~2^w-1,程序最多访问2^w个字节
可在32位或64位机器上运行的程序指令:gcc -m32 prog.c
大端法规则:最高有效字节在最前面
小端法规则:最低有效字节在最前面
在计算机系统中,程序仅仅只是字节序列

The concept of position

Bit or bits (bit): an electronic circuit unit is called a "bit" ( 'bit), which has two stable working condition, respectively, "0" and "1". It is the minimum data unit of the computer.
Byte (byte): 8-bit binary number called a "byte" (byte, short B). It is the basic unit of computer storage of information, but also basic computer storage space capacity of the unit.
Kilobytes (KB), megabytes (MB), gigabytes (GB), terabytes (TB)

1KB=1024B=210B 1MB=1024KB=220B
1GB=1024MB=230B 1TB=1024GB=240B

Word (word) composed of a plurality of bytes, "word" (word): a "word" can be stored in a computer instruction or a data.
The word length of each CPU may comprise a binary word length is called "word length" (word size).
The longer the word length, the more information can be transmitted in the same time.
Word size of the microcomputer 16 (two bytes), 32 bits (four bytes) and the like.

= + Context information bits

All of the information system - comprises a disk file, a program memory, the user data stored in the memory and a data transmission on the network, it is represented by a series of bits. The only way to distinguish between different data objects is the context in which we read these data objects. For example, in a different context, the same sequence of bytes may indicate an integer, float, string or its instructions.

Numerical computation

Unsigned integer

Adder
When an overflow occurs, the overflow of the most significant bit is discarded, the result is obtainedx + y (mod 2^w)

Multiplication
on most machines, an integer multiply instruction rather slow, a combination often used instead of a shift and add operation multiplication

Division: rounding down
x / 2-bit vector x is actually the one to the right
is x / 16 x 4 to the right

Complement arithmetic
addition, multiplication,
division: Shift Right Arithmetic

Store information

Network byte order
of data on the network stream is a stream of bytes, the first byte received is viewed as a high
network byte order is big endian
host network byte order byte order conversion and
htons()the unsigned shortype of t conversion sequence from the host to the network sequence
htonl()to unsigned longcast sequence from the host to the network sequence
ntohs()to unsigned shorttype sequence from network to host order
ntohl()to unsigned longcast from the network to the host sequence sequence

References:
Textbook "in-depth understanding of computer systems"
is the message bits + context
the concept of bits, words, word length

Guess you like

Origin www.cnblogs.com/ldc175206/p/11610428.html