Hi,
The "HASH" function ur talking abt works only with CFMX - I suppose
K'Rgds
Anand
Main Topics
Browse All TopicsUnless I'm missing one, there doesn't seem to be one built in?
First person who can point me in the direction of a free function/custom tag/etc that can encrypt using the md5 algorith gets the points...
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here it is
http://cflib.org/udf.cfm?I
function MD5(message)
{
Var hex_msg = "";
Var hex_msg_len = 0;
Var padded_hex_msg = "";
Var temp = "";
Var var1 = ArrayNew(1);
Var f = 0;
Var h = ArrayNew(1);
Var i = 0;
Var j = 0;
Var k = ArrayNew(1);
Var m = ArrayNew(1);
Var n = 0;
Var s = ArrayNew(1);
Var t = ArrayNew(1);
// convert the msg to ASCII binary-coded form
for (i=1; i LTE Len(message); i=i+1) {
hex_msg = hex_msg & Right("0"&FormatBaseN(Asc(
}
// compute the msg length in bits
hex_msg_len = Right(RepeatString("0",15)
for (i=1; i LTE 8; i=i+1) {
temp = temp & Mid(hex_msg_len,-2*(i-8)+1
}
hex_msg_len = temp;
// pad the msg to make it a multiple of 512 bits long
padded_hex_msg = hex_msg & "80" & RepeatString("0",128-((Len
// initialize MD buffer
h[1] = InputBaseN("0x67452301",16
h[2] = InputBaseN("0xefcdab89",16
h[3] = InputBaseN("0x98badcfe",16
h[4] = InputBaseN("0x10325476",16
var1[1] = "a";
var1[2] = "b";
var1[3] = "c";
var1[4] = "d";
// look at my crazy nested if action - courtesy of no elseif statement!
for (i=1; i LTE 64; i=i+1) {
t[i] = Int(2^32*abs(sin(i)));
if (i LE 16){
if (i EQ 1){
k[i] = 0;
}
else {
k[i] = k[i-1] + 1;
}
s[i] = 5*((i-1) MOD 4) + 7;
}
else {
if (i LE 32) {
if (i EQ 17) {
k[i] = 1;
}
else {
k[i] = (k[i-1]+5) MOD 16;
}
s[i] = 0.5*((i-1) MOD 4)*((i-1) MOD 4) + 3.5*((i-1) MOD 4) + 5;
}
else {
if(i LE 48) {
if (i EQ 33) {
k[i] = 5;
}
else {
k[i] = (k[i-1]+3) MOD 16;
}
s[i] = 6*((i-1) MOD 4) + ((i-1) MOD 2) + 4;
}
else {
if (i EQ 49) {
k[i] = 0;
}
else {
k[i] = (k[i-1]+7) MOD 16;
}
s[i] = 0.5*((i-1) MOD 4)*((i-1) MOD 4) + 3.5*((i-1) MOD 4) + 6;
}
}
}
}
// process the msg 512 bits at a time
for (n=1; n LTE Evaluate(Len(padded_hex_ms
a = h[1];
b = h[2];
c = h[3];
d = h[4];
msg_block = Mid(padded_hex_msg,128*(n-
for (i=1; i LTE 16; i=i+1) {
sub_block = "";
for (j=1; j LTE 4; j=j+1) {
sub_block = sub_block & Mid(msg_block,8*i-2*j+1,2)
}
m[i] = InputBaseN(sub_block,16);
}
for (i=1; i LTE 64; i=i+1) {
if (i LE 16) {
f = BitOr(BitAnd(Evaluate(var1
}
else {
if (i LE 32) {
f = BitOr(BitAnd(Evaluate(var1
}
else {
if (i LE 48) {
f = BitXor(BitXor(Evaluate(var
}
else {
f = BitXor(Evaluate(var1[3]),B
}
}
}
temp = Evaluate(var1[1]) + f + m[k[i]+1] + t[i];
while ((temp LT -2^31) OR (temp GE 2^31)) {
temp = temp - Sgn(temp)*2^32;
}
temp = Evaluate(var1[2]) + BitOr(BitSHLN(temp,s[i]),B
while ((temp LT -2^31) OR (temp GE 2^31)) {
temp = temp - Sgn(temp)*2^32;
}
temp = SetVariable(var1[1],temp);
temp = var1[4];
var1[4] = var1[3];
var1[3] = var1[2];
var1[2] = var1[1];
var1[1] = temp;
}
h[1] = h[1] + a;
h[2] = h[2] + b;
h[3] = h[3] + c;
h[4] = h[4] + d;
for (i=1; i LTE 4; i=i+1) {
while ((h[i] LT -2^31) OR (h[i] GE 2^31)) {
h[i] = h[i] - Sgn(h[i])*2^32;
}
}
}
for (i=1; i LTE 4; i=i+1) {
h[i] = Right(RepeatString("0",7)&
}
for (i=1; i LTE 4; i=i+1) {
temp = "";
for (j=1; j LTE 4; j=j+1) {
temp = temp & Mid(h[i],-2*(j-4)+1,2);
}
h[i] = temp;
}
Return h[1] & h[2] & h[3] & h[4];
}
Business Accounts
Answer for Membership
by: boughtonpPosted on 2002-11-17 at 11:09:18ID: 7460261
Okay, there IS a function that does md5 as part of CFML, it's called "Hash".
Now, I can't be bothered to go get the question closed and I'm feeling generous, so the first person to answer with something remotely funny will get the points. :)