HOME - WEBDESIGN / IPHONE APP - ALL IN VAIN - PICTURES - FORUM - DEVELOPEMENT - MYSPACE - TWITTER - YOUTUBE - CATEGORIES - Login/Registration - RSS

Countdown bis zum Greenfield 2011:


PL/SQL: How to convert MD5 from Hex to Base64


in Application Server,Code,Computer,Development @ 13:51 am 16. November 2009
Comments: 0

I was working with JBoss 5.1.0GA and I wanted to activate the JBoss MD5 Authentication. The passwords were stored as HEX 16Byte long (32 Hex Characters). When you have a look at the official JBoss User Manual (Chapter 9) you will see that they are using Base64-Encoding. So we had to come up with a short PL/SQL-script to convert the passwords to Base64!

Simply create a PL-SQL Script and add the following code:

[codesyntax lang="plsql"]

set sqlblanklines on;

set serveroutput on;

DECLARE

BEGIN

//read password field as hex-encoded raw data and convert data using base64 encoding

update users set password=utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(utl_raw.cast_to_varchar2(password))));

END;

[/codesyntax]

Additionally, if you have a unix or linux machine, you can check it in command line:

$ echo -n “j2ee” | openssl dgst -md5 -binary | openssl base64 glcikLhvxq1BwPBZN0EGMQ==

An Twitter senden, Geposted von Pädde


no comments

Leider gibts noch keine Comment für diesen Post, möchtest du einen hinzufügen?

Abonniere die Benachrichtigung für diesen Post.

schreib nen fetten comment!