| Provides a static utility interface to an MD5 digest algorithm
obtained through the java.security.MessageDigest spi.
Database end-users may wish to access the services of this class
to provide, for instance, application user lookup tables with
one-way password encryption. For example:
-- DDL
CREATE TABLE USERS(UID INTEGER IDENTITY, UNAME VARCHAR, UPASS VARCHAR, UNIQUE(UNAME))
CREATE ALIAS MD5 FOR "org.hsqldb.lib.MD5.encodeString"
-- DML & DQL
INSERT INTO USERS(UNAME, UPASS) VALUES('joe', MD5('passwd'))
UPDATE USERS SET UPASS = MD5('newpasswd') WHERE UNAME = 'joe' AND UPASS = MD5('oldpasswd')
SELECT UID FROM USERS WHERE UNAME = 'joe' AND UPASS = MD5('logonpasswd')
NOTE:
Although it is possible that a particular JVM / application installation may
encounter NoSuchAlgorithmException when attempting to get a jce MD5 message
digest generator, the likelyhood is very small for almost all JDK/JRE 1.1
and later JVM implementations, as the Sun java.security package has come,
by default, with a jce MD5 message digest generator since JDK 1.1 was
released. The HSLQLDB project could have provided an MD5 implementation to
guarantee presence, but this class is much more lightweight and still allows
clients to install / use custom implementations through the
java.security.MessageDigest spi, for instance if there is no service
provided by default under the target JVM of choice or if a client has
developed / provides, say, a faster MD5 message digest implementation.
In short, this class is a convenience that allows HSQLDB SQL Function and
Stored Procedure style access to any underlying MD5 message digest algorithm
obtained via the java.security.MessageDigest spi
author: boucherb@users.sourceforge.net version: 1.7.2 since: 1.7.2 |