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:

Pavel Co Ebele said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

jorick228 said...

Make a lot of money with online casino BGAOC we have top rated online casinos If you want to always be in the money, then try to play online casino with us.

siva said...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.
Thank you for this blog. This for very interesting and useful.
Java training in Chennai
Java training in Bangalore
Java online training
Java training in Pune
Java training in Bangalore|best Java training in Bangalore

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

Riya Raj said...

Phenomenal Blog!!! thanks for your post and awaiting for your new updates...
Digital Marketing Course in Chennai
Digital Marketing Training in Chennai
Digital Marketing Training
Digital Marketing Course
Digital marketing course in Annanagar
Digital marketing course in vadapalani
Android training in Chennai
Python Training in Chennai
Big data training in chennai
JAVA Training in Chennai

shwethapriya said...

Nice blog was really feeling good to read it. Thanks for this information.
Spoken English Classes in Chennai
Best Spoken English Class in Chennai
German Classes in Chennai
pearson vue exam centers in chennai
Informatica MDM Training in Chennai
Hadoop Admin Training in Chennai
Spoken English Classes in Tnagar
Spoken English Classes in OMR

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

andriya said...

Great Blog!!! Was an interesting blog with a clear concept. And will surely help many to update them.
RPA Training in Chennai
RPA course in Chennai
RPA Training Institute in Chennai
UiPath Training in Chennai
Blue Prism Training in Chennai
Machine Learning course in Chennai
RPA Training in Vadapalani
RPA Training in Thiruvanmiyur
RPA Training in Guindy
RPA Training in Anna Nagar

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

priya rajesh said...

Great collection and thanks for sharing this info with us. Waiting for more like this.
Best AngularJS Training in Chennai
Angularjs Training institute in Chennai
AngularJS Training in Chennai
Angular 2 Training in Chennai
Angular 7 Training in Chennai
PHP Training in Chennai
Web Designing course in Chennai
AngularJS Training in Porur
AngularJS Training in Tambaram
AngularJS Training in Adyar

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

manjuragul 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

sasi said...

The concept you are saying is good. I was so happy after reading this article. Thankyou so much for good article.
Web Designing Course in chennai
Web Designing Course in bangalore
web designing course in coimbatore
web designing training in chennai
web designing training in madurai
Web Development courses in Chennai
web designing training institute in chennai
DOT NET Training in Bangalore