Showing posts with label Password Encryption. Show all posts
Showing posts with label Password Encryption. Show all posts

Friday, June 1, 2012

Password Encryption (Hex Code) using java


In my early blog (http://nanjundanonlinedictonary.co.in/2012/02/password-encryprion-using-java.html), I had articulated the easy way of password encryption using java. The program would result an encrypted text in a hash format but not in a hex code as we can see in Spring ACEGI framework. Here in this article, we are specifically focus on possibilities to convert SHA hash password SHA hex password.

Old Code:
  
byte rawBytes[] = md.digest();
String hashPassword = (new BASE64Encoder()).encode(rawBytes);
  

New Code:

byte rawBytes[] = md.digest();
StringBuffer strBuffer = new StringBuffer();
      for (byte rawByte : rawBytes) {
        strBuffer.append(Integer.toHexString((int) (rawByte & 0xff)));
      }
String hexText = strBuffer.toString();

Saturday, February 4, 2012

Password Encryption using Java

Hi Guyz,

My Business Unit is in the process of creating a new development process tool something like Teamtracker for Internal purpose. I was identified as a secondary developer to complete the tool three weeks back. Almost 70% of the development activities have been completed so far. Within an application, we have list of users and their credential details, roles and projects etc.. and those details were stored in database as a plain text.

Early this week I got a requirement from my BA to replace the exiting “plain text” passwords to “hash codes“ and he gave me only 2 hrs to complete the requirement. I was afraid to take that task when I heard it from him. Since the application is built with Spring framework, I thought I can apply ACEGI framework to apply security with in the application. Considering the fact TIME (Existing application code rewrite and the estimation – always worrying factor), thought of do some Google Search and see if I can find anything exciting.

I found a very interesting article on Password Encryption using java code (http://www.devbistro.com/articles/Java/Password-Encryption). Beauty of this article is it is self explanatory, it doesn't require any third party jar files. With in 15 mins of time, I was able to complete the requirement.

Thought of sharing my learning’s to my readers as well. Hope you also enjoy! Happy programming.


Cheers

Nanjudan Chinnasamy

Pega Decisioning Consultant - Mission Test Quiz & Answers

The Pega Certified Decisioning Consultant (PCDC) certification is for professionals participating in the design and development of a Pega ...