Difference between hashing and encryption

Posted on Wednesday 18 February 2009

Nowadays no one is trustworthy anymore on the internet. You wouldn‘t want all your private data to be made public when you buy something online now, would you. This calls for security measures. That‘s where encryption and hashing come into play. Both hashing and encryption use an algorithm to transform insecure plaintext information into a secure enciphered format. Both methods use a key to encrypt the data. With hashing the plaintext is the key itself. With encryption the key allows you to decrypt the encrypted data.

Read more →

How to remove all subversion .svn files and folders

Posted on Tuesday 17 February 2009

Recently my cornerstone (a subversion client) got corrupted and I couldn‘t checkout my working copy. So I had to remove all of the .svn folders and files by hand. A very labour-intensive job if your website consists of about 3000 files.

Terminal to the rescue:

just go to your folder, containing all the subversion files, in the terminal and type in:

find . -name ”.svn” -type d -exec rm -rf {} ;

This will search for all the .svn folders and remove them.

Read more →

Backup all your databases on your server at once using php

Posted on Monday 16 February 2009

I‘ve altered a php script which I found on the php classes website, to backup all your databases at the touch of a button. The databases have to reside on the same server though. I‘ll change this when I find some spare time. You can download these files below. It includes a folder with a number of files. To use this method of database backup, you first of all have to make a database which contains all your database information like:

Read more →

Allow only numeric input or disallow spaces with Javascript

Posted on Wednesday 11 February 2009

This is a very easy way to restrict users from inputting any characters other then numbers or restrict users from entering spaces in e.g. login and password fields. You can restrict other characters by adding the charcodes to the function. You can check the charcodes at cambiaresearch.com

You can download the files below.

Usage:

Load in the javascript file and add onkeypress=“return isNumberKey(event)” in the input tag.

like so:

input type=“text” name=“numeric” id=“numeric” value=”” maxlength=“12” onkeypress=“return isNumberKey(event)” 

Read more →

Some useful mac shortcuts

Posted on Tuesday 10 February 2009

command option eject: This puts your mac fast to sleep

control shift eject: turns off your screen

command shift 4: I use this to measure pixels, but it‘s intended to make screenshots

command option d: show and hide the dock

Control Eject:Restart, Sleep, Shutdown dialog box

Control command D: Looks up a word in the dictionary. simon showed me this one. A reasonably unknown shortcut in my opinion. You can use this shortcut in any Cocoa application (Mac native) like safari and a small tooltip will appear above the word your mouse pointer is hovering. You don‘t need to have the dictionary open so you can easily use this at all times. 

Read more →

Restricting access to a directory using htaccess and generate a htpasswd file using php

Posted on Tuesday 10 February 2009

htaccess:

first make a htaccess file with the following:

AuthType Basic

AuthName “Restricted Area”

AuthUserFile path/to/.htpasswd

require valid-user

Make sure there are no extra spaces after AuthUserFile, otherwise it won‘t work. The AuthUserFile is the path to the .htpsswd file we‘ll be creating next. Apache uses the mod_auth module for basic authentication. Keep in mind that the basic Authtype is quite vulnerable because it sends the passwords and logins unencrypted as plaintext and can hereby be captured by anyone listening in. The HTTP Digest Authentication on the other hand protects your password and login information whilst being transferred by including it in a message digest that has been hashed with MD5.

htpasswd:

Now, we‘ll create a file called .htpasswd. The following lines are case-sensitive. The password has to be MD5‘d. Use aMD5 generator to do this. This is an example of a htpasswd file:

steven:5f4dcc3b5aa765d61d8327deb882cf99
seconduser:5f4dcc3b5aa765d61d8327deb882cf99

Read more →