如何在javascript中创建一个简单的wep密钥生成器? [英] how can i make a simple wep key generator in javascript?
问题描述
我试图制作一个wep密钥生成器,并且我已经阅读了wep密钥如何工作但我真的不知道如何开始制作它。谁能给我一个例子或指导我一个教程?我尝试使用谷歌但没有运气。
im trying to make a wep key generator and ive read how wep keys work but i really dont even know how to start making it. can anyone give me an example or direct me to a tutorial? i tried using google but no luck.
推荐答案
在javascript中...
in javascript...
function generateHexString(length) {
var ret = "";
while (ret.length < length) {
ret += Math.random().toString(16).substring(2);
}
return ret.substring(0,length);
}
// 40-/64-bit WEP: 10 digit key
alert("40-bit:" + generateHexString(10));
// 104-/128-bit WEP: 26 digit key
alert("104-bit:" + generateHexString(26))
// 256-bit WEP: 58 digit key
alert("256-bit:" + generateHexString(58));
如果你想根据固定的字符串输入生成一些东西,那么也有一些方法可以做到这一点...这应该只是一个正确长度的直接随机十六进制字符串给你你正在寻找的东西。
If you wanted to generate something based on a fixed string input, there are methods for doing that as well... this should give you what you are looking for in terms of just a straight random hex string of the correct length.
我不确定是否有一个标准密码短语到WEP生成器,但大多数都将输入限制为可打印字符,而且算法通常很弱。最好的办法就是只要使用WPA2PSK即可。
I'm not sure if there is a standard passphrase to WEP generator, but most limit the input to printable characters, and the algorythms are generally weak.. best bet is to simply use WPA2PSK if you can.
这篇关于如何在javascript中创建一个简单的wep密钥生成器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!