| Author |
Topic |
|
anu_mca_knit
Starting Member
2 Posts |
Posted - 2007-05-11 : 03:32:05
|
| I have a column user_password in my table that keeps the password of the users.When i use select user_password from table_namethen all the values are shown in query analyzer as they are.But i want to show only stars(*) .How to solve this problem??? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-11 : 03:36:52
|
How about this?SELECT COL1, COL2, REPLICATE(DATALENGTH(PASSWORD), '*') AS PASSWORDFROM TABLE Just kidding !!Frankly this is a front-end issue and better handled there.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 04:32:31
|
| don't store passwords in plain text at all.hash them with MD5 and insert the hash into the db._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-11 : 04:32:39
|
quote: Originally posted by harsh_athalye How about this?SELECT COL1, COL2, REPLICATE(DATALENGTH(PASSWORD), '*') AS PASSWORDFROM TABLE Just kidding !!Frankly this is a front-end issue and better handled there.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
You did it reverselyThat should beSELECT COL1, COL2, REPLICATE('*',DATALENGTH(PASSWORD)) AS PASSWORDFROM TABLEThough I like your front end adviceMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-11 : 04:40:55
|
quote: Originally posted by spirit1 don't store passwords in plain text at all.hash them with MD5 and insert the hash into the db._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp
You meant to say "encrypt and store"?MadhivananFailing to plan is Planning to fail |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 04:57:11
|
| no i don't mean encrypt and store.Encryption can be decrypted.A hash can't. Let's not get into details about MD5 being broken etc..._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-11 : 05:34:47
|
Thanks. I think I need to read about hash MadhivananFailing to plan is Planning to fail |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-11 : 07:15:55
|
| Thanks Madhi for the correction.Spirit, the OP doesn't care about how to store password in table he just want to show it as number of asterisks.Anyway, Anu see if the below links help you for encryption:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76258&SearchTerms=encrypt[/url][url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61364&SearchTerms=encrypt[/url]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-11 : 07:19:17
|
true. but i think that he should see the error of his way _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|