对IE和Webkit中的加密随机数是否有内置的浏览器支持? Firefox有window.crypto [英] Is there any built in browser support for crypto random numbers in IE and Webkit? Firefox has window.crypto
问题描述
有什么类似于 https://developer.mozilla.org/en/javascript_crypto 对于IE或webkit浏览器?
Is there anything similar to https://developer.mozilla.org/en/javascript_crypto for IE or webkit browsers?
我只需要生成加密安全的伪随机数,但我不想包括一个大的第三方js库。
I just need to generate cryptographically secure pseudo-random numbers, but I don't want to have to include a large 3rd party js library.
推荐答案
这是一个相当小的SHA1模块,可以种植Date.now +一些盐n胡椒提供一个相当随机串。删除alphas并继续呼叫,直到您有足够的数字为您的需要。
This is a fairly small SHA1 module that could be seeded with Date.now + some salt n pepper to provide a fairly random string. Strip out the alphas and keep calling until you have enough numbers for your needs.
http://www.movable-type.co.uk/scripts/sha1.html
肯定是hacky - 所以也许一个ajax调用web服务就足够了?
Definitely hacky - so perhaps an ajax call to a webservice would suffice?
这篇关于对IE和Webkit中的加密随机数是否有内置的浏览器支持? Firefox有window.crypto的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!