2013-03-24 | openGLUG

Pages

Saturday 30 March 2013

Bless Hex Editor


Hex Editor:

A hex editor or binary file editor or byte editor is a program which allows the users to manipulate binary data which as a whole constitutes to a computer file. The name 'hex' comes from the 'hexadecimal'( A numerical system consisting of 16 fundamental digits).

Bless Hex Editor:

Bless Hex Editor is one such hex editor for ubuntu. It is written in mono/Gtk# and its primary platform is GNU/Linux. However it should be able to run without problems on every platform that mono and Gtk# run. Bless Hex Editor, in addition to all features that a hex editor must have like editing files as a sequence of bytes, allowing read/write, also offers many other features such as search, pattern finding, efficient query-replace, multi-tabbing, customized data-views, plugins etc.


Bless currently provides the following features:
  • Efficient editing of large data files and block devices.
  • Multilevel undo - redo operations.
  • Customizable data views.
  • Fast data rendering on screen.
  • Multiple tabs.
  • Fast find and replace operations.
  • A data conversion table.
  • Advanced copy/paste capabilities.
  • Highlighting of selection pattern matches in the file.
  • Plugin based architecture.
  • Export of data to text and html (others with plugins).
  • Bitwise operations on data.
  • A comprehensive user manual.
System Requirements for Bless Hex Editor:
  • Mono runtime (version 1.1.14 or higher)
  • Gtk#2 (version 2.8 or higher)
Both mono runtime, and Gtk# can be downloaded from Mono-Project site or from Ubuntu Software Center or also from terminal by running command, "sudo apt-get install mono-runtime"

Friday 29 March 2013

XOR Encryption and It's implementation in C

As you might know, encryption is hiding data by masking them with some other data. There are many exncryption algorithms used for encrypting any confidential data. XOR, SHA, MD5, RSA and DSA etc. are few of them. Today i am going to explain what is XOR encryption and how it works and also implementation of XOR in C programming Language.
About XOR Encryption Method:
In Cryptography, the XOR cipher is a type of additivecipher, and an encryption algorithm. Operation of XOR Encryption Algorithm is based on following four principles.
  1. A XOR 0 = A
  2. A XOR A = 0
  3. (A XOR B) XOR C = A XOR (B XOR C)
  4. (B XOR A) XOR A = B XOR 0 = B
where A, B and C are called boolean varibales which can have values 0 and 1 which represents a bit. And XOR is called Exclusive-OR operation in Boolean algebra. Exclusive-OR(XOR):- As it's name suggests, XOR is exclusively OR operation which means that, if there are two varibales op11110011erated using XOR operation then the result is 1(In some cases refered as true), only when any one and only one of the two varibales has value eaqual to 1.
Example: If A=1 and B=0 then A XOR B = 1
If A=1 and B=1 then A XOR B = 0
How XOR Encryption Works?
XOR Encryption works by repeating XOR operation on each character of the given string and the key string. So to decrypt the encrypted data, just pass the decrypted text as the string input and the same key used for the encryption as the key.
Example:(From Wikipedia)
In 8-bit ASCII, the string 'Wiki' can be represented as '01010111 01101001 01101011 01101001', where each 8-bit word represents the letters W, i, k and i respectively.
 The XOR operation is carried out in the follwing manner using the key '11110011'.
01010111 XOR 11110011 = 10100100
01101001 XOR 11110011 = 10011010
01101011 XOR 11110011 = 10011000
01101001 XOR 11110011 = 10011010
So the encrypted output will be ascii text equivalent of '10100100 10011010 10011000  10011010'
This is the simplest working example of the XOR encryption. There are other implementations too, which stands different because of their iteration steps.
Note:- XOR encryption can be made very strong(Even unbreakable) by using true random numbers. But normally XOR encryption is considered to be very weak. This is because encrypted data can be subjected to plaintext attacks to get the key and there by leading to the possibility of decryption of confidential data. So no standards recommend XOR Encryption for data protection.
Implementation of XOR Encryption In C
As i have already explained the basic technique of XOR Encryption, i am not going to explain much about the program and it's working wherever it is not necessary to do so. Also remember that while using the below specified code to encrypt textual data, the key should have atleast the length of the string to be encrypted. Otherwisse there might be some data lose after decrypting again.
Here goes a simple C Code:-
#include <stdio.h>
#include <string.h>
int main()
{
  int i;
  char string[100]="";
  char key[100]="!@#$%^&*()_"; //Default key.
   printf("\n Enter the string to be ciphered: ");
  scanf("%s",&string); //Read the string to be encrypted and store it in 'string' variable
  printf("\n Enter the key: ");
  scanf("%s",&key); //Read the string to be used as key and store it in 'key' variable
  printf("\n Ciphered text :  ");
  for(i=0; i<strlen(string); i++)
{
string[i]=string[i]^key[i]; //Perform the XOR operation on i'th caharcter of the string and i'th character of the key.
  }
  printf("%s\n",string); //print the ciphered text to the screen.
  return 0;
}

Thursday 28 March 2013

Installing LAMP on Ubuntu




 LAMP Stands for Linux Apache MySQL and PHP ( Sometimes Perl or Python also)
 LAMP is a package consisting of a elemental components of a general purpose web server.

Installation of LAMP is splitted up into four steps.

Step 1. Installation of Apache HTTP Server 2:
  To install Apache 2 on your system, Open terminal. Then enter the following command.                 
                                                
                                                  'sudo apt-get install apache2'   
                                       
 You have to enter the admin password to install any softwares. So enter your admin password and complete the installation.
To test your apache installation, open any browser of your choice and navigate to 'http://localhost/' or '127.0.0.1' 

Step 2. Installation of PHP 5:
  To install PHP5 on your Ubuntu system, open terminal and enter the following command.

                                    'sudo apt-get install php5 libapache2-mod-php5'
This command will install PHP5 in your system along with the required libraries to work with Apache2.
To activate PHP5 you have to restart the Apache server. To do so, execute the following terminal command.
                   
                   'sudo /etc/init.d/apache2 restart'

Step 3. Installation of MySQL:

 Again, to install MySQL open terminal and run the command given 

                  'sudo apt-get install mysql-server' 

 After finishing all the 3 steps explained above, you have LAMP system on your computer.

MySQL we installed is a console based DataBase Management System which is little difficult to handle. So we need a light weight, easy-to-use utility to do all our DBM(Database Management) jobs. Most commonly used and the recommended one is the phpMyAdmin.

Installation of phpMyAdmin is very easy. All that you need to do is, just execute the command given below via terminal.

          'sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin'