Skip to main content
nikos101
Inspiring
September 29, 2008
Question

I need a function that will go through and encrypt all the strings

  • September 29, 2008
  • 3 replies
  • 439 views
I want to use one way enryption and need a function that will go through and encrypt all the strings in my password column in sql server 2003.

I also need a function that compares a test password string is equal to the hash value in the database. Can anyone give me some advice in this?
This topic has been closed for replies.

3 replies

Inspiring
October 6, 2008
Apparently it's not as simple as I thought. My first instinct was

update yourtable set password = '#hash(password)#'

but that will crash

This is inefficient, but you only have to do it once.

query1
select id, password thepassword
from yourtable

cfloop query="query1"

update yourtable
set password = '#hash(thepassword)#'
where id = #id#
nikos101
nikos101Author
Inspiring
October 6, 2008
Can you give me the update query that will hash the column please?
Inspiring
September 29, 2008
For the first question, it depends on the encryption algorithm you want to use. If it was cold fusion hash, a simple update query will do.

For the 2nd question, once again it's simple sql. Hash the test password sting so you are comparing one hashed value to another.