Rabu, 29 Mei 2013 0 komentar

Number & Letter Randomizing Algorithm


People actually spend a lot of time on good ways to pick pseudo-random numbers.  They try a bunch of different complicated formulas, and try to make sure that patterns don’t pop up.  But we can build a simple one pretty easily to pick pseudo-random numbers from 1 to 10. 
 
random i = 7 * i mod 11  
Since it’s a function, it needs to have an input.  It then multiplies that input by 7, and then finds the remainder when dividing by 11.  We’ll give it the previous number it picked as input, and it will give us back the next one.  Suppose we start at 1.  Then we get the following:
 
random  1 ->  7
random  7 ->  5
random  5 ->  2
random  2 ->  3
random  3 -> 10
random 10 ->  4
random  4 ->  6
random  6 ->  9
random  9 ->  8
random  8 ->  1
 
Since the answer is always a reminder when dividing by 11, it’ll be somewhere between 0 and 10.  But it should be pretty easy to convince ourselves that if the number we give as input is between 1 and 10, then 0 isn’t a possibile answer: if it were, then we’d have found two numbers, both less than 11, that multiply together to give us a multiple of 11.  That’s impossible because…. 11 is prime.  So we’re guaranteed that this process picks numbers between 1 and 10.  It seems to pick them in a non-obvious order with no really obvious patterns, so that’s good.  We appear to have at least a good start on generating random numbers. Notice a couple things:
  • We had to pick somewhere to start.  In this case, we started out by giving an input of 1.  That’s called the seed.  If you use the same seed, you’ll always get the exact same numbers back!  Why?  Because it’s really just a complicated math problem, so if you do the same calculation with the same numbers, you’ll get the same result.
  • To get the next number, we have to remember something (in our case, the last answer) from the previous time.  That’s called the state.  The state is important, because it’s what makes the process give you different answers each time!  If you didn’t remember something from the last time around, then you’d again be doing the same math problem with the same numbers, so you’d get the same answer.
The Algorithm Method for randoming words is : First - Last Method

For Letter :
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
Example :
SECURE
become 
HVXFIV
Rabu, 08 Mei 2013 2 komentar

Permutation-Based Cryptography



The translation of text from clear form to an encrypted form and back is a common problem in computing.  One simple technique for encrypting text is based on the mathematical notion of a permutation.  A permutation of the integers 0 through N-1 is simply a one-to one function whose domain and range are both the set of integers {0, 1, 2, . . . , N-1}.  In other words, a permutation transforms each integer in the set {0, 1, 2, . . . , N-1} into another integer in the same set, with no two integers being transformed into the same result.  For example, here is a permutation of {0, 1, 2, 3, 4}.


This permutation can be used to encrypt a sequence of five characters by moving each character from its original position to the position defined by the permutation.  For example, the sequence "APPLE" would be translated into the string "PLEAP":

Note that we number positions starting at zero just as in C++ arrays — that’s a hint of things to come.  What about decrypting the text above?  Well, each permutation has an inverse, another permutation that does the exact opposite of the original permutation.  For the permutation given above, the inverse permutation is:


Apply the inverse permutation to the scrambled sequence "PLEAP"; you should get back the original sequence "APPLE".  That’s the key point about encryption/decryption using a permutation, apply the permutation, and then apply its inverse, and you get back where you started.

Data Encryption Standard (DES)
DES is the archetypal block cipher — an algorithm that takes a fixed-length string of plaintext bits and transforms it through a series of complicated operations into another ciphertext bitstring of the same length. In the case of DES, the block size is 64 bits. DES also uses a key to customize the transformation, so that decryption can supposedly only be performed by those who know the particular key used to encrypt. The key ostensibly consists of 64 bits; however, only 56 of these are actually used by the algorithm. Eight bits are used solely for checking parity, and are thereafter discarded. Hence the effective key length is 56 bits, and it is always quoted as such.The key is nominally stored or transmitted as 8 bytes, each with odd parity. According to ANSI X3.92-1981, section 3.5: One bit in each 8-bit byte of the KEY may be utilized for error detection in key generation, distribution, and storage. Bits 8, 16,..., 64 are for use in ensuring that each byte is of odd parity.

Sabtu, 13 April 2013 0 komentar

Conventional Encryption Model


Plaintext is an original text / data which will be converted into a random nonsense text called ciphertext in order to prevent the original message being read by the people out of the recipient. The encryption process consists of an algorithm that produce a different output depending on the specific key being used at the time and a key which value is independent of the plaintext and shared by sender and recipient. The ciphertext can be transformed back to the original plaintext by using a decryption algorithm and the same key that was used for encryption. The security of conventional encryption depends on the secrecy of the key, not the secrecy of the algorithm. It is impractical to decrypt a message based on the ciphertext plus knowledge of the encryption/decryption algorithm. The principal security problem is maintaining the secrecy of the key.

Security of conventional encryption depends on several factors:
-. The encryption algorithm must be impractical to decrypt a message on the basis of the ciphertext and knowledge of the encryption/decryption algorithm.
-. Secrecy of the key

  


Referring to the image above, message (X) will be encrypted using algorithm key (K) and the encryption process will produce the ciphertext (Y).

            Y = EK(X)

While the recipient  will decrypt the ciphertext (Y) into message (X) using the same algorithm key (K) as the key used to encrypt.

            X = D K(Y)
Senin, 01 April 2013 6 komentar

Depth First Search (DFS) & Breath First Search (BFS)



Depth-First Search (DFS)
Pencarian dilakukan pada satu node dalam setiap level dari yang paling kiri. Jika pada level yang paling dalam, solusi belum ditemukan, maka pencarian dilanjutkan pada node sebelah kanan. Node yang kiri dapat dihapus dari memori. Jika pada level yang paling dalam tidak ditemukan solusi, maka pencarian dilanjutkan pada level sebelumnya. Demikian seterusnya sampai ditemukan solusi. Jika solusi  ditemukan maka tidak diperlukan proses backtracking (penelusuran balik untuk mendapatkan jalur yang dinginkan).

Kelebihan DFS adalah:
• Pemakain memori hanya sedikit, berbeda jauh dengan BFS yang harus menyimpan semua node yang pernah dibangkitkan.
• Jika solusi yang dicari berada pada level yang dalam dan paling kiri, maka DFS akan menemukannya secara cepat.

Kelemahan DFS adalah:
• Jika pohon yang dibangkitkan mempunyai level yang dalam (tak terhingga), maka tidak ada jaminan untuk menemukan solusi (Tidak Complete).
• Jika terdapat lebih dari satu solusi yang sama tetapi berada pada level yang berbeda, maka pada DFS tidak ada jaminan untuk menemukan solusi yang paling baik (Tidak Optimal).

Breadth First Search(BFS)
Merupakan algoritma yang melakukan pencarian secara melebar yang mengunjungi simpul secara preorder yaitu mengunjungi suatu simpul kemudian mengunjungi semua simpul yang bertetangga dengan simpul tersebut terlebih dahulu. Selanjutnya, simpul yang belum dikunjungi dan bertetangga dengan simpul-simpul yang tadi dikunjungi, demikian seterusnya. algoritma BFS menggunakan graf sebagai media representasi persoalan, tidak sulit untuk mengaplikasikan algoritma ini dalam persoalan-persoalan teori graf.

Cara Kerja Algoritma BFS
Dalam algoritma BFS, simpul anak yang telah dikunjungi disimpan dalam suatu antrian. Antrian ini digunakan untuk mengacu simpul-simpul yan bertetangga dengannya yang akan dikunjungi kemudian sesuai urutan pengantrian.
Untuk memperjelas cara kerja algoritma BFS beserta antrian yang digunakannya, berikut langkah-langkah algoritma BFS:
  1. Masukkan simpul ujung (akar) ke dalam antrian
  2. Ambil simpul dari awal antrian, lalu cek apakah simpul merupakan solusi
  3. Jika simpul merupakan solusi, pencarian selesai dan hasil dikembalikan.
  4. Jika simpul bukan solusi, masukkan seluruh simpul yang bertetangga dengan simpul tersebut (simpul anak) ke dalam antrian
  5. Jika antrian kosong dan setiap simpul sudah dicek, pencarian selesai dan mengembalikan hasil solusi tidak ditemukan
  6. Ulangi pencarian dari langkah kedua
Senin, 18 Maret 2013 0 komentar

The Definition and Use Of X-800 & RFC 2828

X-800 is an extention recommendation of the recommendation X-200 which describes the reference model for Open System Interconnection (OSI). It establishes a framework for coordinating the development of existing and future recommendations for the system interconnection. The objective of OSI is to permit the interconnection of heterogeneous computer systems so that communication between application process may be achieved. At various times, security controls need to be built in order to protect the information exchanged between application processes,but by doing so the cost and time of obtaining and modifying data will be greater than the potential value of the informations.
This recommendation defines the general security related architectural elements for which protection of communication between open system is required. It establishes within the framework of reference model, guidelines and constraints to improve the existing recommendation in order to allow secure communications.

X-800 provides a general description of security services and related mechanisms and defines the positions within the reference model where the services and mechanisms may provide.

The OSI security architecture provides a useful overview of many concepts that take eyes on the mechanisms, services and security attacks which can be described as following :
•    Security Attack        : any action that compromises the security of information owned by somebody including unauthorized reading of a message of file and traffic analysis.
•    Security Mechanism    : any process that designed to detect or preventing a security attack to be held.
•    Security Service    : a process of enhancing / improving the security of data processing system and information exchange between application processes.

In this literature, the term threat and attack are commonly used to have similar definitions but here we try to provide definitions of threat and attack according to RFC 2828 :
•    Threat
A potential violation of security which exist when there is an action or event that could breach security and cause harm.
•    Attack
An intelligent act that is a deliberate attempt to evade security services and violate the security policy of a system.

According to X-800 standards, there are 8 security dimensions addresses to network vulnerability :
1.    Access control  
2.    Authentication
3.    Non – repudiation
4.    Data consistency
5.    Communication security
6.    Data integrity
7.    Avaliabity
8.    Privacy

X.800 defines a security service as a service provided by a protocol layer of communicating open systems, which ensures adequate security of the systems or of data transfers.The following are considered to be the security services which can be provided optionally within the framework of OSI reference model.

1.    Authentication
These services require authentication information compromising locally stored information and data for authenticating.
-. Peer Entity Authentication : this service is provided for use at the establishment or during data transfer phase of a connection to confirm the identities of one or more of the entities connected to one or more of the other entities.
-. Data Origin Authentication : this service provides the corroborations of the source of a data unit, it doesn’t provide protection against duplication or modifications of data units.

2.    Access Control
Provides protection against unauthorized use of the resources accessible via OSI, may be applied to various type of access to a resource.

3.    Data Confidentiality.
Provides the protection of data from unauthorized disclosure using these methods : connection confidentiality, connectionless confidentiality, selective fields confidentiality, traffic flow confidentiality.

4.    Data Integrity
This service counter active threats, at the start of the connection using the peer entity authentication service and the data integrity service during the life of the connection can provide the detection of duplication of data units.

5.    Non – Repudiation
This service is divided into 2 types :
1.    Non – repudiation with proof of origin : the recipient is provided with proof of the origin data , this will protect any attempt by the sender to falsely deny sending the data or its contents.
2.    Non – repudiation with proof of delivery : the sender is provided with proof of delivery, this will protect against any subsequent attempt by recipient to falsely deny receiving the data or its contents.

Specific Security Mechanisms
The following mechanisms may be incorporated into the appropriate layer in order to provide some of the service :
1.    Encipherment
2.    Digital signature mechanism
3.    Access control mechanism
4.    Data integrity mechanism
5.    Authentication exchange mechanism
6.    Traffic padding mechanism
7.    Routing control mechanism
8.    Notarization mechanism

Pervasive Security Mechanisms
This mechanism describes a number of mechanisms which are not specific to any particular service, they are not explicitly described as being in any particular layer but some can be regarded as aspects of security management directly related to the level of security required.
1.    Trusted functionality
2.    Security labels
3.    Event detection
4.    Security audit trail
5.    Security recovery
 
;