Information Security system Design Fundamentals third Week study summary

Source: Internet
Author: User

The main points are summarized:

The one or three most important numbers indicate:

Unsigned number, signed (twos complement), floating-point number

Consider why a vulnerability arises from the reverse:

The result is too large to indicate when the overflow is generated and the negative result is obtained.

Second, information storage

1. Conversion: Binary as the bridge.

2. Word Length: 32-bit 64-bit

3. Data size: Single precision (4 bytes), double precision (8 bytes)

4. Declaring pointers:

For any data type T, declare

T *p;

Indicates that P is a pointer variable that points to an object of type T.

The 5.gcc–m32 can generate 32-bit code on a 64-bit machine.

6. Addressing and byte order:

Byte order is the basis of network programming. The small end is "high-to-high, low-to-low", and the big-endian is the opposite.

7.P28 Code:

The data type byte_pointer is defined with a typedef as a pointer to an object of type "unsigned char".

8. Boolean algebra:

(1) Logical operation:

All logical operations can be used with, or, and not expressed. With or without the expression "and not" or "not". Therefore, all the mathematical operations can be achieved with one and the other.

(2) Bitwise operation:

Bit vectors: A string with a fixed length of W, consisting of 0 and 1.

The operation of a bit vector: an operation between each corresponding element of a parameter, such as a &,|,^,~ corresponding to a and B vector group

9. Mask:

We can do this by specifying a bit vector mask, selective enable or not blocking some signals.

One of the positions is 1 o'clock, indicating that the signal I is valid, and 0 indicates that the signal is blocked.

Thus, this mask represents a set of valid information.

Bit-level operations in the 10.C language:

The C language supports Boolean operations.

The best way to determine an expression is to say that the hexadecimal parameter expands to binary and performs a binary operation, and then converts it back to 16 binary.

Logical operations in the 11.C language:

logical operators

The logical operation considers that all parameters other than 0 represent true, and parameter 0 represents false, and they return 1 or 0, respectively, indicating that the result is true or false.

Shift operations in the 12.C language:

X<<k means x moves the K bit to the left, discards the highest k bit, and complements K 0 at the right end.

The arithmetic right shift is the value that complements K's most significant bit at the left.

Third, integer representation

1. Data type long long is introduced in ISO C99 and requires at least 8 bytes of representation.

2. Complement code:

The complement uses the length of the register as a fixed feature to simplify mathematical operations. Similar to a clock.

By using the complement, the mathematical operations can be unified into addition, as long as an adder can achieve all the mathematical operations.

3. Conversion of signed and unsigned numbers:

The bit vectors do not change. Information is a bit + context.

4. How to make a positive number equal to a negative number:

in negative numbers x after adding u , which can be converted to (2^w+x)

5.
0 Extension : converts an unsigned number to a larger data type and simply adds 0 to the front.
similar to logical left (right) shift. symbol Extension: Converts a complement number to a larger data type, adding a copy of the highest effective bit value in the representation. similar to arithmetic left (right) shift. 6. truncateNumber: When a number of w bits is truncated to a number of k digits, we discard the high w-k bit(binary).get a bit vector for: 2^w mod 2^k, there may be overflow.

Four, integer operations:

1. How do I overflow an integer operation? How to avoid it? An overflow of arithmetic operations means that the full integer result cannot be placed into the word length limit of the data type. An overflow occurs when two numbers are 2^w or larger. 2. The final thought on integer arithmetic:is actually a form of modulo operations, providing a flexible way to represent both negative and positive numbers. The same bit-level implementation is used with the execution of unsigned arithmetic. 3. Inaccuracy and rounding of floating-point numbers:floating-point numbers encode a number like V = x*2^y, which is mostly close to 0 or very large numbers. when a number cannot be represented precisely in this form, it must be adjusted up or down, that is, rounding.

Five, floating point number

1.IEEE floating point Standard:

encode a number with v= ( -1) ^sM2^e.

Symbol: s Determines whether the number is negative (S=1) or positive (s=0), and the sign bit with the value 0 is interpreted as a special case.

Mantissa: M is a binary decimal order: E is weighted against floating-point numbers and can be negative

Float:s=1 bit, exp=8 bit, frac=23 bit

Double:s=1 bit, exp=11 bit, frac=52 bit

2. Integers and floating-point numbers indicate the relationship of the same number:

P74: The relative region corresponds to the low of the integer, just before the highest significant bit equal to one stop, and a floating point representation of the fractional part of the high-level match.

3. Integer and floating-point conversion rules:

convert integers into floating point numbers:

Integers are first converted into binary, the decimal point left a number of digits are normalized, take out the fractional part of the value, in the back of 0 to make it reach 23 bits;

The result of the Frac plus offset is expressed in binary notation, placed in front of the removed part, plus a symbol bit.

(The exercise is on the book)

Six, thinking and sentiment:

The main problem of learning in this chapter is to constantly re-understand the content of the previous study with new thinking. Why is this, how to explain. Some formulas are most important to understand.

At first I did not understand the truncation of the IEEE floating point of knowledge, thought too difficult to understand, but later read the summary of others, in exchange for different ways to understand, but also so-so know some.

There is still a long way to go about mastering data types, but I will try.

Information Security system Design Fundamentals third Week study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.