Code Monkey home page Code Monkey logo

computational-intelligence-assignment-1's Introduction

Computational-Intelligence-Assignment-1

An AI-based group assignment for Sunway University's CI module, which utilizes the concept of machine learning to create 2 modules by perform computational oprations of textual encryption & decryption and air-conditioned fuzzy system. Detailed descriptions of how each of the algorithm works are described in this report

Textual Encryption & Decryption System

Encryption & Decryption

Encryption

The system are capable of encrypting a plaintext of user input by converting it to a ciphertext and secret key, both of which must be in kept in pair for the purpose of successfull decryption. This process is carried out entirely by the use of Genetic Algorithms. Excerpt from our report describing how the process works :

Genetic algorithm is an adaptive heuristic searching algorithm that based its ideas from the evolutionary ideas of natural selection of Darwinism. (Doc.ic.ac.uk, n.d.) It comprises of 3 main functionality, namely, reproduction, crossover, and mutation. In my implementation of the encryption with genetic algorithm, I took partial inspiration from the pseudocode provided by the article “Secret Key Encryption Algorithm Using Genetic Algorithm” by Ankita Agarwal. I also included my own modifications to make this a better encryption rather than just to encrypt marks, it is now able to encrypt any texts to multi-paragraph levels. In nature, our modifications allow each same sequence of input text to be converted to different ciphertext and keys for each encryption process. The input is first specified by the user, and then it is converted into ASCII decimal representation, then it is converted to a 8-bit binary representation for each and every single character. For example, the user entered “A1”, the ASCII code decimal representation of the character “A” will be 65, while the representation for integer “1” would be 49. Then the decimal is converted into a 8-bit representation, the 8-bit of 65 will be [0,1,0,0,0,0,0,1], and [0,0,1,1,0,0,0,1] for 49. Each character is represented separately and encrypted separately. The pseudocode in reference did not state about the selection process for the crossover, therefore in this section I’ve choose to randomize the index of bit selection for every single encryption process in crossover and mutation. This ensures maximum anonymity as nothing is certain, the secret keys generated will be the selected bits to be crossed and mutated. Following the pseudocode, the crossover function is done swapping the 2 selected key’s position. Although it is a simple process, but swapping bits around makes a big differences in the representation of the binary. For example, the keys for the first encryption for character “A” is 4 and 8, then the result 8-bit will be [1,1,0,0,0,0,0,0], if we convert back to decimal representation this result would be 192, a big differences from 65. After crossing, the mutation of the value will take place, similarly, the author did not mention about the possibility of mutation to occur. I choose to allow a 100% occurrence of the mutation because the generation of encryption is very small, therefore allowing 100% mutation rate allows us to achieve the optimum resolution faster. Following the pseudocode, the bit inversion operation is implemented, which changes the state of the bit from 0 to 1 and vice versa. The secret key which is used to represent the chosen element to be inversed is also generated randomly to maximize anonymity. Continuing the previous example, if the secret key generated is 1, the first element in the value will be inverted, the result would be [0,1,0,0,0,0,0,0], which is 64 in decimal. Generation of encryption is random to maximize anonymity and to provide better security. Once there is at least a 4 bit of difference between the masked value and the original value, it will exit the loop of the encryption and it is considered masked. For example: “A” original ASCII bit representation [0,0,1,1,0,0,0,1], the value [1,0,0,1,1,0,0,0] is achieved in the 10th generation of encryption, the encryption process is considered done. The differences here is the first, third, fifth, and the eighth bit, which sums up to total of 4 differences in bit. Once the last character has been fully encrypted, the 8-bit representations is converted back to ASCII decimal, and then back to the actual integer and characters. The secret keys used during the crossover and mutation are all recorded under a variable using the stringBuilder class provided by java API, the keys are then pass to the decrypter to be used to do reverse engineering on the encryption. During the development of the genetic algorithm, we faced the problem to choose the most suitable generation for the encryption process. Due to the nature of having a constant value, the hacker may be able to see through this weak point and obtain the exact value of the generations we are using the encrypt the information. One alternatives we thought up was to set the generation up until the bits are the direct opposite of the original value. However, this exposes another weak point where every word’s ASCII decimal representation is the exact opposite of itself. Thus, finally we’ve set up to 4 differences, when the 8-bit representation has 4 differences, we will end the encryption. This will ensure anonymity of the original value because the attacker will have a hard time to determine whether which 4 is the different even if they found out how the algorithm works.

Decryption

Decryption is carried out with by the use of Artificial Neural Network, and there are a total of 2 neural networks in total. Description: Decryption Process

Air Conditioned Fuzzy System

AirConFuzzySystem Basing on a user survey conducted, we form a ruleset which allows the system to determine a coldness level based on user input's of air conditioner temperature and weather temperature by incorporating fuzzy logic.

computational-intelligence-assignment-1's People

Contributors

foomethod avatar mrrexz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.