You are on page 1of 114

REVIEW CSI104

1. Introduction
The idea of a universal computational device was first put forward by
Alan Turing in 1937. He proposed that all computations can be performed
by a special kind of a machine, now called a Turing machine.
 The von Neumann model defines a computer as four subsystems:
memory, arithmetic logic unit, control unit, and input/output. The von
Neumann model states that the program must be stored in memory.
We can think of a computer as made up of three components: computer
hardware, data, and computer software.
The
history of computing and computers can be divided into three periods: th
e period of mechanical machines (before 1930), the period of electronic c
omputers (1930–1950), and the period that includes the
five modern computer generations.
 With the invention of computers a new discipline has evolved, computer
science, which is now divided into several areas.
2. Number System
• Integers
An integer (an integral number with no fractional part) in the decimal
system is familiar
to all of us—we use integers in our daily life. In fact, we have used
them so much that they
are intuitive. We represent an integer as
The value is calculated as:

Reals
BINARRY
Hexa - Octal
Hexa

Octal
convert
Convert
Convert
Convert
Convert
Convert
3. Data Storage
• Data inside the computer
All data types are transformed into a uniform representation when
they are stored in a computer and transformed back to their original
form when retrieved. This universal representation is called a bit
pattern.
Storing integers
STORING TEXT

• Text is made up from M symbols, can be represented as M n-bit patterns, each pattern
defining a single symbol.
• Bảng mã ASCII : sử dụng 7 bít để biểu diễn 1 ký tự
• Bảng mã Extended ASCII: sử dụng 8 bít để biểu diễn 1 ký tự
• Bảng mã Unicode: sử dụng 32 bít để biểu diễn 1 ký tự
4. Operator on data
Shift operations
5. Computer Organization
6. Computer Networks
and Internet
7. Operating Systems
8. Algorithms
The cubes represent the algorithm
9. Programming language
10. Software Engineering
PROCEDURE ORIENTED OBJECT ORIENTED
• Biểu đồ luồng dữ liệu • Biểu đồ Usecase
• Biểu đồ thực thể liên kết • Biểu đồ Lớp
• Biểu đồ trạng thái • Biểu đồ trạng thái
PROCEDURE ORIENTED OBJECT ORIENTED
• Structure charts • classes with attributes and
methods
11. Data Structure
• A data structure uses a collection of related variables that can be
accessed individually or as a whole. In other words, a data structure
represents a set of data items that share a specifc relationship. We
discussed three data structures in this chapter: arrays, records, and
linked lists.
• An array is a sequenced collection of elements normally of the same
data type. We use indexes to refer to the elements of an array. In an
array we have two types of identifers: the name of the array and the
name of each individual element.
• Many applications require that data is stored in more than one
dimension. One common example is a table, which is an array that
consists of rows and columns Two-dimensional arrays can be stored in
memory using either row-major or column-major storage. The first is
more common
• The common operations on arrays as a structure are searching,
insertion, deletion, retrieval, and traversal. An array is a suitable
structure in applications where the number of deletions and insertions
is small but a lot of searching and retrieval operations are required. An
array is normally a static data structure and so is more suitable when
the number of data items is fixed.
• A record is a collection of related elements, possibly of different types,
having a single name. Each element in a record is called a field. A field
is the smallest element of named data that has meaning in a record.
• A string is a set of characters that is treated like an array in some
languages and as a type in others.
• A linked list is a collection of data in which each element contains the
location of the next element; that is, each element contains two parts:
data and link. The data part holds the useful information: the data to be
processed. The link is used to chain the data together.
• The same operations defined for an array can be applied to a linked
list. A linked list is a very efficient structure for data that will go
through many insertions and deletions.
• A linked list is a dynamic data structure in which the list can start with
no nodes and grow as new nodes are needed.
12. Abstract Data Types
• A stack is a restricted linear list in which all additions and deletions
are made at one end, called the top. If we inserted a series of data
items into a stack and then removed them, the order of the data is
reversed. This reversing attribute is why stacks are known as a last in,
first out (LIFO) structure. We defined four basic operations on a stack:
stack, push, pop, and empty
• A queue is a linear list in which data can only be inserted at one end, called the
rear, and deleted from the other end, called the front. These restrictions ensure
that data is processed through the queue in the order in which it is received. In
other words, a queue is a first in, first out (FIFO) structure. We defined four
basic operations for a queue: queue, enqueue, dequeue, and empty. A general
linear list is a list in which operations, such as insertion and deletion, can be
done anywhere in the list—at the beginning, in the middle, or at the end. We
defined six operations for a general linear list: list, insert, delete, retrieve,
traverse, and empty
• A tree consists of a finite set of elements, called nodes (or vertices), and a finite set of
directed lines, called arcs, that connect pairs of nodes. If the tree is not empty, one of the
nodes, called the root, has no incoming arcs. A binary tree is a tree in which no node can
have more than two subtrees. In other words, a node can have zero, one, or two
subtrees. A binary tree traversal requires that each node of the tree be processed once
and only once in a predetermined sequence. The two general approaches to the
traversal sequence are depth first and breadth first. A binary search tree (BST) is a binary
tree with one extra property: the key value of each node is greater than the key values of
all nodes in each left subtree and smaller than the value of all nodes in each right
subtree
• A graph is an ADT made up of a set of nodes, called vertices, and set
of lines connecting the vertices, called edges or arcs. Whereas a tree
defines a hierarchical structure in which a node can only have a single
parent, each node in a graph can have one or more parents. Graphs
may be either directed or undirected
13. Struct File
14. Data Base
• Definition: A database is a collection of related, logically coherent,
data used by the application programs in an organization.
operator
• Insert
• Update
• Delete
• Select
• Alter
14.5 DATABASE DESIGN
The frst step normally involves a lot of interviewing
of potential users of the database, to collect the
information needed to be stored and the access
requirements of each department.

The second step is to build an entity–relation model


(ERM) that defnes the entities for which some
information must be maintained, the attributes of
these entities, and the relationship between these
entities.

Next step is to build relations based on the ERM and


normalize the relations
16. Security
1.1. Traditional symmetric-key ciphers
1.1.2 Monoalphabetic ciphers
• In a monoalphabetic cipher, a character (or a symbol) in the plaintext is always
changed to the same character (or symbol) in the ciphertext regardless of its
position in the text. For example, if the algorithm says that letter A in the
plaintext is changed to letter D, every letter A is changed to letter D. In other
words, the relationship between letters in the plaintext and the ciphertext is
one-to-one.
• The simplest monoalphabetic cipher is the additive cipher (or shift cipher).
Assume that the plaintext consists of lowercase letters (a to z), and that the
ciphertext consists of uppercase letters (A to Z). To be able to apply
mathematical operations on the plaintext and ciphertext, we assign numerical
values to each letter (lower- or uppercase), as shown in Figure 16.4.
1.1. Traditional symmetric-key ciphers
• 1.1.2 Monoalphabetic ciphers
• Security
1.1. Traditional symmetric-key ciphers
• 1.1.3 Polyalphabetic ciphers
• In a polyalphabetic cipher, each occurrence of a character may have a different
substitute.
• The relationship between a character in the plaintext to a character in the
ciphertext is one-to-many. For example, ‘a’ could be enciphered as ‘D’ at the
beginning of the text, but as ‘N’ in the middle. Polyalphabetic ciphers have the
advantage of hiding the letter frequency of the underlying language. Eve cannot
use single-letter frequency statistics to break the ciphertext.
• To create a polyalphabetic cipher, we need to make each ciphertext character
dependent on both the corresponding plaintext character and the position of the
plaintext character in the message. This implies that our key should be a stream of
subkeys
1.1. Traditional symmetric-key ciphers
• 1.1.3 Polyalphabetic ciphers
• each subkey depends somehow on the position of the plaintext character that
uses that subkey for encipherment. In other words, we need to have a key
stream k 5 (k1, k2, k3, …) in which ki is used to encipher the ith character in the
plaintext to create the ith character in the ciphertext.
• To see the position dependency of the key, let us discuss a simple polyalphabetic
cipher called the autokey cipher. In this cipher, the key is a stream of subkeys, in
which each subkey is used to encrypt the corresponding character in the
plaintext. The first subkey is a predetermined value secretly agreed upon by Alice
and Bob. The second subkey is the value of the first plaintext character (between
0 and 25). The third subkey is the value of the second plaintext character, and so
on:
1.1. Traditional symmetric-key ciphers
1.1.3 Polyalphabetic ciphers
1.1. Traditional symmetric-key ciphers
• 1.1.4 Transposition ciphers
• A transposition cipher does not substitute one symbol for another;
instead it changes the location of the symbols. A symbol in the first
position of the plaintext may appear in the tenth position of the
ciphertext. A symbol in the eighth position in the plaintext may
appear in the first position of the ciphertext. In other words, a
transposition cipher reorders (transposes) the symbols
1.1. Traditional symmetric-key ciphers
• 1.1.4 Transposition ciphers
 A transposition cipher does not
substitute one symbol for another;
instead it changes the location of
the symbols.
 A symbol in the first position of the
plaintext may appear in the tenth
position of the ciphertext.
 A symbol in the eighth position in
the plaintext may appear in the first
position of the ciphertext. In other
words, a transposition cipher
reorders (transposes) the symbols
Stream and block ciphers

• The literature divides the symmetric ciphers into two broad categories:
stream ciphers and block ciphers.
• Stream cipher: In a stream cipher, encryption and decryption are done one
symbol (such as a character or a bit) at a time. We have a plaintext stream, a
ciphertext stream, and a key stream. Call the plaintext stream P, the
ciphertext stream C, and the key stream K:

• Block ciphers: In a block cipher, a group of plaintext symbols of size m (m . 1)


are encrypted together, creating a group of ciphertext of the same size. Based
on the definition, in a block cipher, a single key is used to encrypt the whole
block even if the key is made of multiple values. In a block cipher, a ciphertext
block depends on the whole plaintext block.
1.2 Modern symmetric-key ciphers
• The traditional symmetric-key ciphers that we have studied so far are
character-oriented ciphers. With the advent of the computer, we need
bit-oriented ciphers. This is because the information to be encrypted is
not just text; it can also consist of numbers, graphics, audio, and video
data.
• It is convenient to convert these types of data into a stream of bits, to
encrypt the stream, and then to send the encrypted stream. In
addition, when text is treated at the bit level, each character is
replaced by 8 (or 16) bits, which means that the number of symbols
becomes 8 (or 16) times larger. Mixing a larger number of symbols
increases security. A modern cipher can be either a block cipher or a
stream cipher.
1.2 Modern symmetric-key ciphers
• 1.2.1 Modern block ciphers
• A symmetric-key modern block cipher encrypts an n-bit block of
plaintext or decrypts an n-bit block of ciphertext. The encryption or
decryption algorithm uses a k-bit key. The decryption algorithm must
be the inverse of the encryption algorithm, and both operations must
use the same secret key so that Bob can retrieve the message sent by
Alice. Figure 16.6 shows the general idea of encryption and
decryption in a modern block cipher.
1.2 Modern symmetric-key ciphers
• 1.2.2 Modern stream ciphers
2. Asymmetric-key ciphers
• Symmetric- and asymmetric-key ciphers will exist in parallel and
continue to serve the community.
• In symmetric-key cryptography, the secret must be shared
between two persons. In asymmetric-key cryptography, the secret
is personal (unshared); each person creates and keeps his or her
own secret.
• Compare between two system :

• And
• (e x d) mod ((p-1)*(q-1)) = 1
Ví dụ: Xác định cặp khóa (e,n), (d,n) bằng
giải thuật RSA
• Giả sử: Chọn p =3, q = 5
• Ta có n = 3x5 =15
• Q = (3-1) x(5-1) = 8
• Chọn e và d sao cho e * d mod 8 = 1
ÞTa có e * d = k * 8 +1
ÞCác cặp e, d ta có thể chọn:
Þe =9, d =1 Hoặc e =1, d=9 vì 1 x9 mod 8 = 9 mod 8 =1
ÞHoặc e = 3, d =11 hoặc e =11, d=3 vì 3 x 11 mod 8 =33 mod 8 =1
Þ……

You might also like