What I've Learned (4 of 4)

by Michael Clark
April 16, 2012 9:05 AM

The last post in this series takes me back to one of the first projects I worked on - Only1 Version 4. I previously wrote a post about this project detailing how the new version was different than its previous incarnations. This post will attempt to describe how the image verification process works.

When working on this project, we looked at various options to do image verification - including licensing a third party product. In the end, we decided to write our own solution. 

To accomplish this, I first started by parsing a username (mclark, jdoe, etc.) into a set a 10 integers ranging from 1-100 using an encryption library released on CodePlex called CTI Text Encryption. This library has a set of options that allowed me to determine the output block size (2 in this case), output format (numbers only), encryption key, and even the separator. It's a pretty powerful library. For instance, the username "jdoe" might encrypt to 2-10-72-64-98-32-33-66-7-99. The library will return duplicate numbers so I had to handle those cases in my code by incrementing one of the duplicates by one.

Once I got the encrypted name into a set of 10 integers, I matched up each integer with a row in our database. The filenames of each of our images were placed in a database with unique ID numbers - for instance, "dog1.jpg" may be ID1. I then returned the file names to my code and placed them on the page.

Sounds pretty easy, but there was quite a bit of research and thought put into this. Overall, I was very pleased with how it turned out.

Add comment

  • Comment
  • Preview