2019-2020-1 20,175,311 Hu Jidong "Information security system design basis" summed up the fourth week of learning materials learning

2019-2020-1 20,175,311 Hu Jidong "Information security system design basis" summed up the fourth week of learning materials learning

2.1 Information Store

Basic concepts
  • That machine program memory as a very large array of bytes , called virtual memory .
  • Each memory byte has a unique digital identifier, called its address . The set of all possible addresses is called the virtual address space . Is used to indicate the word length integer pointer data and the nominal size, the size of the virtual address space by the word length determined for a word length of w bits of the machine, the virtual address range of 0-2. 1-w ^ .
  • Byte is the smallest addressable memory unit.
  • Hexadecimal notation: If the total number of bits is not a multiple of 4, the leftmost set may be less than 4, the front with zeros. Pointer data word length and the integer indicating the nominal size.
  • A very useful feature is that it supports the C language bitwise Boolean operations.
  • C language logical operations: || OR or; && AND and;! Non-NOT.
  • Logical operators and the corresponding bitwise important is the difference between: logic operations that, all non-zero parameters are TRUE, parameter 0 is FALSE, return values of 0 and 1; if the first parameter for the evaluation can be determine the result of the expression, then there would be the second argument is evaluated.
  • In general, the machine supports two forms of right: logical shift and arithmetic shift right. Logical right shift of k 0 at the left end up, the result is [0, ..., 0, xn-1, xn-2, ..., xk]. Arithmetic right shift is the complement of k most significant bits of the value at the left end, the result is [xn-1, ..., xn-1, xn-1, xn-2, ..., xk].
Byte order
  • Byte order is the basis for network programming, the memory is more than that accounted for storing a sequence of data type byte in memory, there are usually small end, two kinds of big-endian byte order.
  • It represents an arrangement of two-byte object general rule. In some of the machines selected from a memory according to the least significant byte to most significant byte sequentially stored objects, called small end France ; and others from the machine in accordance with the most significant byte to least significant byte stored sequentially called big or little endian .
  • Visible byte order three cases:
    (1) network application code must follow the rules established on the byte order of the preparation;
    (2) generating (disassembler executable file is determined by the disassembler represented tool instruction sequence);
    (3) a program written to circumvent the normal type of system can be used to allow the cast to an object reference to a data type.

    Boolean algebra
  • Boolean algebra originated in the field of mathematics, it is a formula for a set of arithmetic and logical operations: <B, ∨, ∧, ¬>. Wherein B is a non-empty, ∨, ∧ define two binary operation on the B, ¬ B as defined in one of unary operation .
  • Boolean algebra by the intersection set operation can be acquired between the different sets, and set or complement, logical operation can be performed for different sets, or non.
  • Boolean algebra is a first principles of logic, the set operation is performed by the Boolean algebra can be obtained between the different sets of intersection, union, or complement, logical operation can be performed for different sets, or non. It represents a bit vector to a finite set.

    2.2 integer

  • Unsigned coded : Suppose there is a w-bit integer data type. We can write the bit vector x →, represents the entire vector, or written [xw-1, xw-2 , ..., x0], each represent a vector. The x → regarded as a binary number representation, the x → is obtained unsigned representation. Unsigned binary has a very important attribute, the value of each encoder is an integer ranging between 0 ~ 2 ^ w-1 and w is has only one of a bijective function.
  • Complement encoding the most common computer has signed representation that complement form. In this definition, the most significant bit word interpreted as a negative right. Can be represented by a numerical range [-2 ^ (w-1) ~ 2 ^ (w-1) -1], each has a unique number of w bits represent the range of complement encoding, function Yige two-shot .
    Note:
    the length (1) of the complement of registers is simplified by using fixed characteristic mathematical operations.
    Range (2) complement is asymmetric.
    (3) maximum unsigned value is just a little more than twice as large as the maximum complement: UMaxw = 2 TMaxw + 1. All complement representation of negative numbers in unsigned bit pattern representation have become positive.

  • Anti-code in addition to the most significant bit of the right is - (2w-1-1) instead -2w-1, and its complement is the same.
  • Original code most significant bit is the sign bit is used to determine the remaining bits should take positive or negative weight right. C language allows conversion between signed and unsigned numbers, the conversion was a principle underlying representation remain unchanged.
  • Zero extension to an unsigned number is converted to a larger data type, simply adding 0 representing the beginning.
  • Sign extension will complement a larger number is converted to a data type, the rule is to add a copy of the most significant bit in the representation of the value. It can be seen, if the bit value is represented as the original [xw-1, xw-2 , ..., x0], then it is extended to a rear [xw-1, ..., xw -1, xw-1, xw-2 , ..., x0].
  • Truncating numbers when a w-bit number x = [xw-1, xw -2, ..., x0] truncated to a k-bit number, discards high wk bits, to obtain a bit vector [xk-1, xk-2 , ..., x0], a truncated numbers could change his value - a form of overflow.
  • Signed numbers into unsigned implicit casts cause certain non-intuitive behavior. These characteristics are often non-intuitive result in a program error, and this error implicit comprising casts nuances difficult to find. Because this cast takes place without a clear indication of the situation in the code, programmers often ignore its impact.

    Integer arithmetic 2.3
  • Unsigned adder consider two non-negative integers x and y, satisfying 0≤x, y≤2w-1. Each number can be expressed as w-bit unsigned number. However, if they are calculated and, we have a range of possible 0≤x + y≤2w + 1-2. And it indicates that this may require w + 1 bits. This ongoing "word inflation" means, in order to fully represent the result of an arithmetic operation, to do for the word limit. Unsigned arithmetic modulo operation can be considered a form. Unsigned adder and the upper mold is equivalent to computing 2w. By simply discarding the most significant bit of w + x + y is a representation of the calculated value.
  • Overflow is the full integer result the total length can not be put to restricted data types.
  • Unsigned multiply range in 0≤x, y≤ integers x and y in 2w-1 can be represented as unsigned w-bit, but their range of product x · y is 0 to (2w-1) 2 = between 22w-2w + 1 + 1. This may require 2w bits. However, the C language unsigned multiplication is defined as the value of w bits, 2w-bit product is an integer of w bits represent a low value. It can be seen as equivalent to the calculated product modulo 2w.
  • Multiplication constant compiler uses an important optimization, try a combination of shift and addition operations instead of multiplication by a constant factor. Split into integer powers of 2 are added, and then using the calculated shift (left), and finally the results are summed. Similarly, for non-negative, the k-bit arithmetic right shift and divided by 2 ^ k is the same.

    2.4 Float
  • Symbol s is the number of the negative decision (s = 1) or positive (s = 0), and 0 for the sign bit values interpreted as a special case.
  • Mantissa M is a binary fraction, its range is 1 ~ 2-ε, or 0 ~ 1-ε.
  • Exponent role of floating-point E is weighted, the weights is a power of two E (may be negative).

After the supplementary code and run shot




Guess you like

Origin www.cnblogs.com/hujidong42/p/11610220.html