在 jquery/javascript 中需要 Sha1 加密 [英] Need Sha1 encryption in jquery/javascript
本文介绍了在 jquery/javascript 中需要 Sha1 加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 php 中有 sha1 加密编码
I have sha1 encryption coding in php
<?php
echo hash('sha1', 'testing'.'abcdb');
?>
但是,我的要求应该是运行页面 xyz.html,所以上面的块不起作用.
but, my requirement should have to run the page xyz.html, so the above block is not working.
所以,我需要在 jquery/javascript 中进行 sha1 加密.通过提供 sha1 加密的编码来帮助我.
So, I need to do sha1 encryption in jquery/javascript. Help me by providing coding for sha1 encryption.
这正是必须转换为脚本的
'<?php echo hash('sha1', 'my-secret-key' . $_REQUEST["email"]); ?>'
推荐答案
有两种方法可以解决此问题,您可以使用 AJAX 调用 PHP 页面并检索 SHA-1.
There are two ways to go about this, you can either use AJAX to call up your PHP page and retrieve the SHA-1.
或者,您可以使用其中一种 JS 库,例如 CryptoJS.
Or, you could use one of the JS libraries, such as CryptoJS.
这篇关于在 jquery/javascript 中需要 Sha1 加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文