createWEPKey([length])
Last updated September 21, 2004
Version: 1 | Requires: CF5 | Library: SecurityLib
Description:
Creates a 40-bit or 128-bit WEP key. Use entirely at your own risk. No security is implied or provided by using this. This function simply creates a key for you.
Return Values:
Returns a string.
Example:
createWEPKey(40) returns: B053D17A22
createWEPKey(128) returns: DAB9CF62B96D59DC0883A3AEA8
createWEPKey() returns: A156F82F5374722B6E1ADEB32B
Parameters:
Name | Description | Required |
---|---|---|
length | Length of the WEP key. Either 40 or 128 (default). | No |
Full UDF Source:
/**
* Creates a 40-bit or 128-bit WEP key.
*
* @param length Length of the WEP key. Either 40 or 128 (default). (Optional)
* @return Returns a string.
* @author Alan McCollough (amccollough@anmc.org)
* @version 1, January 12, 2006
*/
function createWEPKey() {
var baseKey = "";
var key = "";
var defaultLength = 128;
var length = defaultLength;
/* If user has passed in a specfic key length, and they want a 40-bit key,
change the value of length to 40 instead of 128.
Of course, a 40-bit WEP key is trivial to crack, but that is not my problem. */
if (arrayLen(arguments) eq 1) {
if(val(arguments[1]) eq 40)
length = 40;
}
/*
CF generated UUIDs look like this:
73B96C47-F5F1-0F5C-488C7C5170101FA0
8 chars - 4 chars - 4 chars - 16 chars
First off, generate a base key
*/
baseKey = mid(createUUID(),20,16) & mid(createUUID(),15,4) & mid(createUUID(),10,4) & mid(createUUID(),25,2);
/* Create a 40-bit or 128-bit key, as the user requested */
switch(length) {
case "40": {
key = mid(baseKey,10,10);
break;
}
case "128": {
key = baseKey;
break;
}
} //end switch
return key;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016