Saturday, December 1, 2012

MySQL PASSWORD() function in JavaScript


If you need to implement a MySQL PASSWORD() function in JavaScript - use http://code.google.com/p/crypto-js/#SHA-1 with 2 encodings.

Here is an example:

var password = "TestPassword";
var result = ("*"+CryptoJS.SHA1(CryptoJS.SHA1(password))).toUpperCase();
console.log("result : " + result);

Result will be *0F437A73F4E4014091B7360F60CF81271FB73180. If you check it with MySQL password() it will be the same:

mysql> select password("TestPassword") as result;
+-------------------------------------------+
| result                                    |
+-------------------------------------------+
| *0F437A73F4E4014091B7360F60CF81271FB73180 |
+-------------------------------------------+

14 comments:

Madhu Balan said...

You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
Java Training in Chennai
Java Training in Coimbatore
Java Training in Bangalore

gowsika said...

Pretty post,I hope your site useful for many users.
Air Hostess Training Institute in Bangalore
Best Aviation Academy in Bangalore
Airline and Airport Management Courses in Bangalore
Ground Staff Training in Bangalore
Airport Management Courses in Chennai
Ground Staff Training in Chennai
Air Hostess Academy in Chennai
Air Hostess Course in Mumbai
Best Aviation Academy in Chennai
Aviation Training Institutes in Bangalore

andriya said...

Nice article, its very informative content..thanks for sharing...Waiting for next update...
Drupal Training in Chennai
Drupal Training Course
Drupal 7 Certification
drupal training in vadapalani
drupal training in Guindy
Photoshop Classes in Chennai
clinical sas training in chennai
SAS Training in Chennai
javascript training in chennai
Hibernate Training in Chennai

Anbarasan14 said...

I would like to thank the blog admin for sharing this useful information in my vision. I have been searching for this blog for a while.
Spoken English Classes in Chennai
Best Spoken English Classes in Chennai
IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
English Speaking Classes in Mumbai
English Speaking Course in Mumbai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
IELTS Coaching in Anna Nagar
Spoken English Class in Anna Nagar

Reshma said...

Thanks For Sharing a wonderful post . It is really very helpful For Everyone ....
Php Training in velachery
Php Training in Anna nagar
Php Training in Tambaram
Php Training in T nagar
Php Training in Porur
Php Training in Adyar
Php Training in Vadapalani
Php Training in OMR
Php Training in Thiruvanmiyur

sasi said...

It's Looks deeply awesome article!! which you have posted is useful.
German Classes in anna nagar
German Language Course in Chennai
german classes in omr
AWS course in Chennai
Data Science Training in Chennai
German Classes in t nagar
ccna Training in Chennai
IELTS Coaching centre in Chennai

Reshma said...

Nice blog! Thanks for sharing this valuable information
Hacking Course in Chennai
Ethical hacking course in bangalore
Ethical hacking course in coimbatore
Ethical Hacking Training in Bangalore
Certified Ethical Hacking Course in Chennai
Ethical Hacking in Bangalore
Hacking Course in Bangalore
Ethical Hacking institute in Bangalore
Selenium Training in Bangalore
Software Testing course in Bangalore

rocky said...

It is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well. Really very informative post.
python training in chennai

python online training in chennai

python training in bangalore

python training in hyderabad

python online training

python flask training

python flask online training

python training in coimbatore






Jayalakshmi said...

All the best for the upcoming articles. Thats all I are able to say. You most absolutely have built this blog website into something special.
data science training in chennai

data science training in tambaram

android training in chennai

android training in tambaram

devops training in chennai

devops training in tambaram

artificial intelligence training in chennai

artificial intelligence training in tambaram

Darshan Bhalerao said...

Nice content very helpful, It has a very important point which should be noted down. All points mentioned and very well written. Keep Posting & writing such content

AWS Online Training

Tamil novels said...

Very useful article. Thanks for sharing with us.
Tamil novels pdf
Ramanichandran novels PDF
srikala novels PDF
Mallika manivannan novels PDF
muthulakshmi raghavan novels PDF
Infaa Alocious Novels PDF
N Seethalakshmi Novels PDF
Sashi Murali Tamil Novels

Silent Girl said...

I'm for the essential time frame here. I found this board and I in finding It in reality obliging and it helped me out abundance. I'm needing to expertise something already and sponsorship happening others, for instance, you helped me.
Activate Office 2016 Crack

hubert said...

Photographs taken from the top floor using a Supreme IDimager Photo display precisely suited images because of primary.
https://thepcsoft.com/idimager-photo-supreme-crack/

iteducationcentre said...

Great Article.
also, Join SQL classes in Pune