Archive for the Programming Category

PHP Profile Registration Script

Posted July 12, 2010 at 2:46 pm in Programming | No Comments

PHP Profile Registration ScriptI tried my hand at coding a PHP registration script that a user would be able to use to register a profile for a site. My goal was to write a script that enforced a strict registration policy, focusing on enforcing a secure password and reducing the possibility of a fake email address.                 

The policy I created focused on:

  • A unique user name
  • A secure password using a minium of 8 characters in a combination of upper case, lower case, numbers (0-9), and special characters (! @ # $ % &)
  • Your first and last name
  • An e-mail address
  • Your gender

Continue reading..

Wrong ELFCLASS?!?

Posted September 11, 2009 at 12:14 pm in Programming | No Comments

In my programming class this semester which deals with ADTs and algorithms we had to implement our own ADT to handle strings. Normally I will work on my programming assignments in the campus computer lab to avoid any possible issues involving different architectures, versions, libraries, etc. than what I may have at home. (Yes, I realize I could open a session at home on the campus lab systems but I like knowing that it’ll work without any questions later and the lab offers me more space to spread out my materials.) Anyways, I decided that it’s the start of the semester and that the first lab wouldn’t be too difficult and that I could probably complete it at home.

I did a little research involving IDEs and decided to give NetBeans a shot. After the packages had been installed I fired up NetBeans and took it for a spin. Deciding that I liked NetBeans, I began to code my ADT lab assignment and had no issues compiling, linking, or running my code. About an hour later I finished the lab assignment and uploaded the required lab files to my account on the campus lab systems.

The next day, in lab, however, I noticed that the lab had new computers from the previous semester. After logging in and playing around a bit I tried to compile the code I had written the previous night at home. Lo and behold, g++ spit out an error:

ld: fatal: file lab1.o: wrong ELF class: ELFCLASS64

Continue reading..

Basic Cryptanalysis

Posted September 15, 2008 at 6:42 pm in Encryption, Programming | No Comments

My example is very basic and is intended more as an interesting method to begin the complicated and often impossible task of deciphering encrypted messages/codes.

The following C++ program accepts character input from the keyboard or via file redirection. It will count each character instance and report the amount of times each character was used.

Why would anyone want to do this? Depending on the method the original message was encoded with, it may help to determine which characters in the ciphertext are representing specific characters in the plaintext. Certain letters and combinations of letters are used much more frequently than others in the English language. The top twenty most used words in English are: “the of to in and a for was is that on at he with by be it an as his”. The list of the most used letters in the English language in descending order are: “e t a o i n s r h l d c u m f p g w y b v k x j q z”. The letter frequency of the first letter of a word in descending order is “t o a w b c d s f m r h i y e g l n o u j k”, the second letter’s frequency in a word is “h o e i a u n r t” and the third letter’s frequency is “e s a r n i”.

By using this program to compute these letter frequencies and comparing them to known lists as presented above we can gain some insight into the message and possibly crack the code if the code is encoded poorly (simple substitution cipher).

A few limitations to the program include: it treats characters as case-insensitive but can easily be modified to treat characters as case-sensitive and it only works with English alphabetic characters (a-Z). Modifying the program to accept non-standard characters (#, !, etc.) could be added just as easily.

The code: Continue reading..

Page 1 of 3123