2018-2019-1 20165228 "The foundation of Information security system design" The second week study summary textbook learning content Summary information = bit + context
- Unsigned encoding: Represents a number greater than or equal to zero based on the traditional binary notation
- Complement coding: represents the most common way to sign a certificate, a number that can be expressed or positive or negative
- Floating-point encoding: A two-base version of the scientific notation for real numbers
Overflow: The representation of a computer is to encode a number with a finite number of bits, and when the result is too large to be represented, some operations overflow
Storage of information
- 1 bytes are 8 bits, and most computers use 1 bytes as the smallest addressable memory unit.
Machine-level programs treat memory as a very large array of bytes, called Virtual storage. Each byte of the memory is identified by a unique number, called an address. The collection of all addresses is called the address space.
Word
Word length: Indicates the nominal size of the certificate and pointer data. Deciding on the most important system parameters is the maximum size of the virtual address space. For a W-bit machine, the virtual address has a range of 0~2^w-1, and the program accesses up to 2^w bytes.
BYTE permutation rules
- Small End method (little endian): lowest valid byte is arranged at the front
- Big endian: The most effective byte is arranged at the front
Code writing for a network application must follow established rules on byte order to ensure that the sender machine translates its internal representation into the standard of the network, while the receiving machine translates the network standard into its internal representation.
String
- A string in the C language is encoded as an array of characters ending with null (whose value is 0). Each character is represented by a standard encoding, the most common being the ASCII character code.
Different machine types use different and incompatible instructions and encodings. Even if the processor is exactly the same, but running different operating systems, there will be different encoding rules, so the binary code is incompatible.
Decimal and R-Binary conversions
- R basic symbol (0,1,2.R-1)
- R is called the Cardinality (base), which represents the number of different number symbols that can be used on each digit. R is called the right of the first place
Every r into a
Binary vs. octal/16-binary conversion
- Binary conversion to octal: Starting from the low, the decimal number represented by the three-bit binary code is an octal code, and the high position is less than 0.
- Binary conversion to 16 binary: Starting from the low, the decimal number represented by the four-bit binary code as a hexadecimal code, the high level is insufficient when the 0.
When converting octal/16 into binary, you only need to restore each octal code/16 binary code to a three-bit/four-bit binary code.
Bit-level operations
- Bit vectors: fixed-length bits w, strings made of 0 and 1
- Level: From left to right, high to low
Operation:
& (Bitwise AND)
| (Bitwise OR)
~ (bitwise Reversed)
^ (Bitwise XOR)
Logical operations&&(逻辑与)||(逻辑或)!(逻辑非)
A non-0 parameter indicates that true,0 is False
Shift Operations
- Logical right Shift: Move n bits right, fill n 0 at high
Arithmetic right Shift: n bits are shifted right, and the value of n highest bits is added
Conversion between signed number and unsigned number
The general rule for handling the conversion between signed and unsigned numbers of the same length: values may change, but bit patterns do not change.
(1) signed number → unsigned number
Non-negative--remains the same
Negative number--converts to a large positive number
(2) unsigned number → signed number
With 2^* (w-1) as the boundary:
Less than it--remains the same
Greater than--converted to a negative value
[0,2 (W-1)) in the range of numbers, unsigned and complementary expression of the same, outside the range, need to add or subtract 2w
When an operation has both signed and unsigned numbers, it implicitly converts the signed number to the unsigned number and assumes that the two numbers are non-negative.
Unsigned number arithmetic
Floating-point arithmetic
IEEE floating point representation: v= ( -1) s x M x 2E (sign S, Mantissa M, order E)
Round to even (default): Rounds a number up or down, and the least significant number of results is even. Can be used in binary decimals.
Rounds to 0: rounds the integer down, and the negative number rounds up.
Round down: Both positive and negative numbers are rounded down.
Round up: Both positive and negative numbers are rounded up.
Code hosting other (sentiment, thinking, etc., optional)
This week is mainly the study of theoretical knowledge, to learn more about the storage, transformation and operation rules of information in C.
Learning progress Bar
|
Code lines (new/cumulative) |
Blog volume (Add/accumulate) |
Learning time (new/cumulative) |
|
target |
5000 line |
30 |
400 hours |
|
first week |
80/80 |
1/1 |
5/5 |
|
second week |
0/80 |
1/2 |
4/9 |
|
2018-2019-1 20165228 "Information Security system Design Fundamentals" Second week study summary