How to use encrypt method in redwood

Best JavaScript code snippet using redwood

wirelessconf.js

Source:wirelessconf.js Github

copy

Full Screen

1<script>2// wirelessconf_advancedsetup3function SetToDefault()4{5 var F=document.wireless_params_fm;6 if(F.tx_power) F.tx_power.value = 100;7 if(F.beacon) F.beacon.value = 100;8 if(F.rts) F.rts.value = 2347;9 if(F.frag) F.frag.value = 2346;10 if(F.bg_protect) F.bg_protect[0].checked = true;11 if(F.preamble) F.preamble[0].checked = true;12 if(F.short_slot) F.short_slot[0].checked = true;13 if(F.tx_burst) F.tx_burst[0].checked = true;14 if(F.aggregation) F.aggregation[0].checked = true;15 if(F.afterburner) F.afterburner[0].checked = true;16 if(F.rdg) F.rdg[0].checked = true;17 if(F.channel_width) F.channel_width[0].checked = true;18}19function InitWirelessAdvancedMenu(F, mode)20{21 if(mode != WIRELESS_AP_MODE)22 {23 DisableObj(F.tx_power);24 DisableObj(F.beacon);25 DisableObjNames('bg_protect');26 }27}28function ApplyWirelessParams()29{30 var F=document.wireless_params_fm;31 if((F.tx_power.value > 100 ) || (F.tx_power.value < 1 ))32 {33 alert(DESC_INVALID_TX_POWER);34 F.tx_power.focus();35 return;36 }37 else if((F.rts.value > 2347 ) || (F.rts.value < 1 ))38 {39 alert(DESC_INVALID_RTS_THRESHOLD);40 F.rts.focus();41 return;42 }43 else if((F.frag.value > 2346 ) || (F.frag.value < 256 ))44 {45 alert(DESC_INVALID_FRAG_THRESHOLD);46 F.frag.focus();47 return;48 }49 else if((F.beacon.value > 1024 ) || (F.beacon.value < 50 ))50 {51 alert(DESC_INVALID_BEACON_INTERVAL);52 F.beacon.focus();53 return;54 }55 F.paramsact.value ="1";56 F.submit();57}58// wirelessconf_wdssetup59function WDSRun()60{61 var F = document.wdssetup_fm;62 F.act.value = "run";63 F.submit();64}65function WDSDelete() 66{67 var F = document.wdssetup_fm; 68 if(CheckAtleastOneCheck('delchk') == false) 69 {70 alert(MSG_NO_DEL_WDS);71 return;72 }73 if (confirm(MSG_WDS_DEL_WARNING))74 {75 F.act.value = "del";76 F.submit();77 }78}79function AddWDS() 80{81 var F = document.wdssetup_fm;82 var obj;83 if(obj=CheckHW('wdshw'))84 {85 alert(MSG_INVALID_HWADDR);86 obj.focus();87 obj.select();88 return;89 }90 F.act.value = 'add';91 F.submit();92}93var WDS_OFF=094var WDS_MASTER_MODE=195var WDS_SLAVE_MODE=296function Add_MSWDS()97{98 var F = document.wdssetup_fm;99 var obj;100 if(F.wds_name == '')101 {102 alert(MSG_BLANK_SSID);103 F.wds_name.focus();104 F.wds_name.select();105 return;106 }107 F.act.value = 'apply';108 F.submit();109}110function ChangeWdsMode()111{112 var F = document.wdssetup_fm;113 var mode = GetRadioValue(F.wds_mode);114 if( (mode == WDS_OFF) || (mode == WDS_MASTER_MODE))115 {116 DisableObj(F.wds_name);117 DisableObj(F.search_ap_bt);118 DisableRadio(F.prefer_mode);119 }120 else if(mode == WDS_SLAVE_MODE)121 {122 EnableObj(F.wds_name);123 EnableObj(F.search_ap_bt);124 EnableRadio(F.prefer_mode);125 }126}127// wirelessconf_macauth128// actval - policy, delmac, 129function ApplyMacAuth(actval)130{131 var F;132 if(actval=='policy')133 F=document.macauth_fm;134 else135 {136 document.macauth_fm.del_allchk.checked = false;137 F= macauth_dblist.document.macauth_dblist_fm;138 }139 F.act.value=actval;140 F.submit();141}142function AddMacAuth()143{144 var F= macauth_pcinfo.document.macauth_pcinfo_fm;145 var ifrname=macauth_pcinfo;146 if(F.manual_check.checked == true)147 {148 if(obj=CheckHWObj(ifrname,'hw'))149 {150 alert(MSG_INVALID_HWADDR);151 obj.focus();152 obj.select();153 return;154 }155 }156 document.macauth_fm.add_allchk.checked = false;157 F.act.value = 'addmac';158 F.submit();159}160function ChangeManualCheck()161{162 var F= document.macauth_pcinfo_fm;163 if(F.manual_check.checked == true)164 {165 EnableHW('hw');166 EnableObj(F.info);167 }168 else169 {170 DisableHW('hw');171 DisableObj(F.info);172 }173}174function InitMacAuthObj()175{176 var F= document.macauth_pcinfo_fm;177 DisableHW('hw');178 DisableObj(F.info);179}180function SubmitOtherIframe(act)181{182 var F;183 if(act=='addmac')184 {185 F= parent.macauth_dblist.document.macauth_dblist_fm;186 F.submit();187 }188 else if(act=='delmac')189 {190 F= parent.macauth_pcinfo.document.macauth_pcinfo_fm;191 F.submit();192 }193}194// wirelessconf_basicconf195function ChangeMBridgeAP()196{197 var F=document.basicsetup_fm;198 if(F.mbridge_apuse[1].checked == true ) // stop 199 {200 DisableObj(F.ssid);201 DisableObj(F.broadcast_ssid[0]);202 DisableObj(F.broadcast_ssid[1]);203 }204 else205 {206 EnableObj(F.ssid);207 EnableObj(F.broadcast_ssid[0]);208 EnableObj(F.broadcast_ssid[1]);209 }210}211function ChangeWirelessOp(mode)212{213 var F=document.basicsetup_fm;214 var obj;215 if(mode == 0)216 {217 DisableAllObj(F);218 obj=document.getElementsByName('tmenu');219 if(obj[0]) EnableObj(obj[0]);220 obj=document.getElementsByName('smenu');221 if(obj[0]) EnableObj(obj[0]);222 obj=document.getElementsByName('act');223 if(obj[0]) EnableObj(obj[0]);224 obj=document.getElementsByName('run');225 if(obj[0]) EnableObj(obj[0]);226 if(obj[1]) EnableObj(obj[1]);227 obj=document.getElementsByName('wl_mode');228 if(obj[0]) EnableObj(obj[0]);229 obj=document.getElementsByName('apply_bt');230 if(obj[0]) EnableObj(obj[0]);231 }232 else233 {234 EnableAllObj(F);235 if(F.other_wwan_enable && (F.other_wwan_enable.value == 1))236 {237 obj=document.getElementsByName('wwan_enable');238 if(obj[0].value == '1')239 DisableObj(obj[0]);240 else if(obj[1].value == '1')241 DisableObj(obj[1]);242 }243 }244 ChangeWirelessMode();245 ChangeWirelessAuth(F);246}247function ChangeWirelessMode()248{249 var F=document.basicsetup_fm;250 var run = GetRadioValue(F.run);251 var obj;252 var wireless_mode;253 obj = document.getElementById('mbridge_opt0');254 if(obj) obj.style.display = "none";255 obj = document.getElementById('mbridge_opt1');256 if(obj) obj.style.display = "none";257 obj = document.getElementById('mbridge_opt2');258 if(obj) obj.style.display = "none";259 obj = document.getElementById('cbridge_opt0');260 if(obj) obj.style.display = "none";261 obj = document.getElementById('wwan_opt0');262 if(obj) obj.style.display = "none";263 obj = document.getElementById('ap_opt0');264 if(obj) obj.style.display = "none";265 if(F.wireless_mode)266 wireless_mode = GetRadioValue(F.wireless_mode);267 else268 wireless_mode = WIRELESS_AP_MODE;269 if(wireless_mode == WIRELESS_AP_MODE)270 {271 if(run!=0) 272 {273 EnableObjNames('broadcast_ssid'); 274 EnableObjNames('channel'); 275 EnableObjNames('search_channel_bt');276 if( F.wmm ) EnableObjNames('wmm');277 }278 DisableObj(F.wmac_chk);279 DisableHW('hw');280 }281 else if(wireless_mode == WIRELESS_CBRIDGE_MODE)282 {283 if(run!=0) 284 {285 EnableObj(F.wmac_chk);286 EnableObjNames('search_ap_bt');287 }288 if(F.wmac_chk.checked == false)289 DisableHW('hw');290 else if(run!=0)291 EnableHW('hw');292 DisableObjNames('broadcast_ssid');293 DisableObjNames('channel');294 DisableObjNames('search_channel_bt');295 if( F.wmm ) DisableObjNames('wmm');296 }297 else if(wireless_mode == WIRELESS_CWAN_MODE)298 {299 if(run!=0) 300 EnableObjNames('search_ap_bt');301 DisableObj(F.wmac_chk);302 DisableHW('hw');303 DisableObjNames('broadcast_ssid');304 DisableObjNames('channel');305 DisableObjNames('search_channel_bt');306 if( F.wmm ) DisableObjNames('wmm');307 }308 else if(wireless_mode == WIRELESS_MBRIDGE_MODE)309 {310 if (navigator.appName.indexOf("Microsoft") != -1)311 {312 obj = document.getElementById('ap_opt0');313 if(obj) obj.style.display = "block";314 obj = document.getElementById('mbridge_opt0');315 if(obj) obj.style.display = "block";316 obj = document.getElementById('mbridge_opt1');317 if(obj) obj.style.display = "block";318 obj = document.getElementById('mbridge_opt2');319 if(obj) obj.style.display = "block";320 }321 else322 {323 obj = document.getElementById('ap_opt0');324 if(obj) obj.style.display = "table-row";325 obj = document.getElementById('mbridge_opt0');326 if(obj) obj.style.display = "table-row";327 obj = document.getElementById('mbridge_opt1');328 if(obj) obj.style.display = "table-row";329 obj = document.getElementById('mbridge_opt2');330 if(obj) obj.style.display = "table-row";331 }332 333 obj = document.getElementById('cbridge_opt0');334 if(obj) obj.style.display = "none";335 ChangeMBridgeAP();336 }337 338}339function ChangeWirelessAuth(F)340{341 var obj;342 var auth_type=F.auth_type.value;343 var run = GetValue(F.run);344 var encrypt_type = GetRadioValue(F.encrypt_type);345 DisableRadio(F.encrypt_type);346 if((auth_type == AUTH_OPEN) || (auth_type == AUTH_AUTO))347 {348 if(run != 0)349 {350 EnableObj(F.encrypt_type[IDX_NOENC]);351 EnableObj(F.encrypt_type[IDX_WEP64]);352 EnableObj(F.encrypt_type[IDX_WEP128]);353 }354 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type == ENCRYPT_TKIPAES )355 F.encrypt_type[IDX_NOENC].checked = true;356 }357 else if(auth_type == AUTH_KEY)358 {359 if(run != 0)360 {361 EnableObj(F.encrypt_type[IDX_WEP64]);362 EnableObj(F.encrypt_type[IDX_WEP128]);363 }364 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type == ENCRYPT_TKIPAES || encrypt_type == ENCRYPT_OFF )365 F.encrypt_type[IDX_WEP64].checked = true;366 }367 else if((auth_type == AUTH_WPAPSK) || (auth_type == AUTH_WPA2PSK)368 || (auth_type == AUTH_WPAPSKWPA2PSK) || (auth_type == AUTH_WPANONE))369 {370 if(run != 0)371 {372 EnableObj(F.encrypt_type[IDX_TKIPAES]);373 EnableObj(F.encrypt_type[IDX_TKIP]);374 EnableObj(F.encrypt_type[IDX_AES]);375 }376 if(encrypt_type == ENCRYPT_64 || encrypt_type == ENCRYPT_128 || encrypt_type == ENCRYPT_OFF )377 F.encrypt_type[IDX_AES].checked = true;378 }379 ChangeWirelessEnc(F);380}381function ClickWirelessAuth(F, toto)382{383 var obj;384 var auth_type=F.auth_type.value;385 var run = GetValue(F.run);386 var encrypt_type = GetRadioValue(F.encrypt_type);387 DisableRadio(F.encrypt_type);388 if((auth_type == AUTH_OPEN) || (auth_type == AUTH_AUTO))389 {390 if(run != 0)391 {392 EnableObj(F.encrypt_type[IDX_NOENC]);393 EnableObj(F.encrypt_type[IDX_WEP64]);394 EnableObj(F.encrypt_type[IDX_WEP128]);395 }396 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type == ENCRYPT_TKIPAES )397 F.encrypt_type[IDX_NOENC].checked = true;398 }399 else if(auth_type == AUTH_KEY)400 {401 if(run != 0)402 {403 EnableObj(F.encrypt_type[IDX_WEP64]);404 EnableObj(F.encrypt_type[IDX_WEP128]);405 }406 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type == ENCRYPT_TKIPAES || encrypt_type == ENCRYPT_OFF )407 F.encrypt_type[IDX_WEP64].checked = true;408 }409 else if((auth_type == AUTH_WPAPSK) || (auth_type == AUTH_WPA2PSK)410 || (auth_type == AUTH_WPAPSKWPA2PSK) || (auth_type == AUTH_WPANONE))411 {412 if(run != 0)413 {414 EnableObj(F.encrypt_type[IDX_TKIPAES]);415 EnableObj(F.encrypt_type[IDX_TKIP]);416 EnableObj(F.encrypt_type[IDX_AES]);417 }418 if(encrypt_type == ENCRYPT_64 || encrypt_type == ENCRYPT_128 || encrypt_type == ENCRYPT_OFF )419 F.encrypt_type[IDX_AES].checked = true;420 if(run)421 {422 if(auth_type == AUTH_WPAPSK)423 {424 if(toto)425 F.encrypt_type[IDX_TKIP].checked = true;426 else427 F.encrypt_type[IDX_AES].checked = true;428 }429 else if(auth_type == AUTH_WPA2PSK)430 F.encrypt_type[IDX_AES].checked = true;431 else if(auth_type == AUTH_WPAPSKWPA2PSK)432 {433 if(F.encrypt_type[IDX_TKIPAES]) 434 { 435 if(toto)436 F.encrypt_type[IDX_TKIPAES].checked = true;437 else438 F.encrypt_type[IDX_AES].checked = true;439 }440 }441 else442 F.encrypt_type[IDX_AES].checked = true;443 }444 }445 ChangeWirelessEnc(F);446}447function ChangeWirelessEnc(F)448{449 if(document.getElementById('wpapsk_key'))450 {451 var encrypt_type = GetRadioValue(F.encrypt_type);452 document.getElementById('wpapsk_key').style.display = "none";453 document.getElementById('wep_key').style.display = "none";454 if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)455 {456 if (navigator.appName.indexOf("Microsoft") != -1)457 document.getElementById('wep_key').style.display = "block";458 else459 document.getElementById('wep_key').style.display = "table-row";460 }461 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES )462 {463 if (navigator.appName.indexOf("Microsoft") != -1)464 document.getElementById('wpapsk_key').style.display = "block";465 else466 document.getElementById('wpapsk_key').style.display = "table-row";467 }468 ChangeWirelessKeyInput(F,0);469 }470}471function SetWEPKeySize(F,size, reset)472{473 F.wep_key1.size = size;474 F.wep_key1.maxLength = size;475 if(reset) F.wep_key1.value='';476 F.wep_key2.size = size;477 F.wep_key2.maxLength = size;478 if(reset) F.wep_key2.value='';479 F.wep_key3.size = size;480 F.wep_key3.maxLength = size;481 if(reset) F.wep_key3.value='';482 F.wep_key4.size = size;483 F.wep_key4.maxLength = size;484 if(reset) F.wep_key4.value='';485 if( F.wep_key1.value.length != size ) F.wep_key1.value='';486 if( F.wep_key2.value.length != size ) F.wep_key2.value='';487 if( F.wep_key3.value.length != size ) F.wep_key3.value='';488 if( F.wep_key4.value.length != size ) F.wep_key4.value='';489}490function ChangeWirelessKeyInput(F,reset)491{492 var keysize;493 var encrypt_type = GetRadioValue(F.encrypt_type);494 var key_input = GetRadioValue(F.key_input);495 if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)496 {497 if(encrypt_type== ENCRYPT_64)498 keysize = 5;499 else if(encrypt_type== ENCRYPT_128)500 keysize = 13;501 if(key_input == KEY_HEX)502 keysize = keysize * 2;503 F.key_length_desc.value = "(" + MSG_KEY_LENGTH_DESC + keysize + ")";504 SetWEPKeySize(F,keysize, reset);505 }506}507function CheckWEPKeyLength(prefix,length)508{509 var i, allblank = 1;510 for( i = 1 ; i <= 4; i++)511 {512 obj=document.getElementsByName(prefix+i);513 if(!obj)514 {515 alert("Debug: Invalid Key Obj "+prefix+i);516 return 0;517 }518 if(obj[0].value.length) allblank = 0;519 if(obj[0].value && obj[0].value.length != length)520 return obj[0];521 }522 if(allblank)523 {524 obj=document.getElementsByName(prefix+'1');525 return obj[0];526 }527 return 0; 528}529function CheckWEPKeyHex(prefix)530{531 var i, allblank = 1;532 for( i = 1 ; i <= 4; i++)533 {534 obj=document.getElementsByName(prefix+i);535 if(!obj)536 {537 alert("Debug: Invalid Key Obj "+prefix+i);538 return 0;539 }540 if(obj[0].value.length) allblank = 0;541 if(IsHex(obj[0].value)) return obj[0];542 }543 if(allblank)544 {545 obj=document.getElementsByName(prefix+'1');546 return obj[0];547 }548 return 0; 549}550function ApplyWirelessConfig(o_wmode)551{552 var F=document.basicsetup_fm;553 var obj;554 var run=GetRadioValue(F.run);555 if( (run==1) && F.ssid.value == '')556 {557 alert(MSG_BLANK_SSID);558 F.ssid.focus();559 return;560 }561 var wireless_mode = GetRadioValue(F.wireless_mode);562 var encrypt_type = GetRadioValue(F.encrypt_type);563 var auth_type = GetRadioValue(F.auth_type);564 if(wireless_mode == WIRELESS_CBRIDGE_MODE)565 {566 if(F.wmac_chk.checked == true && (obj=CheckHW('hw')))567 {568 alert(MSG_INVALID_HWADDR);569 obj.focus();570 obj.select();571 return;572 }573 }574 // in case of mbridge ... should be added575 // security check576 if(encrypt_type == ENCRYPT_64|| encrypt_type == ENCRYPT_128)577 {578 var key_length, i,obj;579 var key_input = GetRadioValue(F.key_input);580 (encrypt_type == ENCRYPT_64)?(key_length = 5):(key_length = 13);581 if(key_input == KEY_HEX) key_length = key_length * 2;582 if(obj=CheckWEPKeyLength("wep_key",key_length))583 {584 alert(MSG_INVALID_WEP_KEY_LENGTH);585 obj.focus();586 obj.select();587 return;588 }589 if(key_input == KEY_HEX)590 {591 if(obj=CheckWEPKeyHex("wep_key",key_length))592 {593 alert(MSG_INVALID_WEP_KEY_HEXVALUE);594 obj.focus();595 obj.select();596 return;597 }598 }599 }600 else if(encrypt_type == ENCRYPT_TKIP || encrypt_type == ENCRYPT_AES || encrypt_type == ENCRYPT_TKIPAES)601 {602 if(F.wpapsk_key.value.length < 8)603 {604 alert(MSG_INVALID_WPAPSK_KEY_LENGTH);605 F.wpapsk_key.focus();606 F.wpapsk_key.select();607 return;608 }609 }610 if(F.modechange)611 {612 if(o_wmode != wireless_mode)613 {614 F.modechange.value = 1; 615 616 if((wireless_mode == WIRELESS_AP_MODE) && !confirm(MSG_RESTART_CONFIRM_WIRELESS)) return;617 else if((wireless_mode == WIRELESS_CBRIDGE_MODE) && !confirm(MSG_RESTART_CONFIRM_WIRELESS_CBRIDGE)) return;618 if((wireless_mode == WIRELESS_CWAN_MODE) && !confirm(MSG_RESTART_CONFIRM_WIRELESS_WWAN)) return;619 }620 else621 F.modechange.value = 0;622 }623 if(F.smenu.value == 'multibridge' && F.wwan_enable)624 {625 run=GetRadioValue(F.run);626 wwan=GetRadioValue(F.wwan_enable);627 if(run == 1 && wwan == 1)628 {629 if(!confirm(MSG_DEL_WWAN_WANRING))630 return;631 }632 }633 if(F.channel)634 {635 channel=parseInt(GetValue(F.channel));636 if(channel > 50 && channel < 140 )637 {638 if(!confirm(MSG_DFS_WARNING))639 return;640 }641 }642 F.act.value = "apply";643 F.submit();644}645function OnDBLClickAPScanNoWizard(idx)646{647 var obj, encrypt_type, doc;648 if(idx == -1) 649 {650 idx = parseInt(parent.iframe_scan.document.aplist_fm.apidx.value);651 doc = parent.iframe_scan.document;652 }653 else654 doc = document;655 if(doc.scan_fm.scan_type.value == 'wds')656 {657 obj=doc.getElementsByName('ssid');658 if(!parent.opener.document.wdssetup_fm)659 {660 alert( MSG_OPENER_PAGE_MOVED );661 parent.close();662 return;663 }664 parent.opener.document.wdssetup_fm.wds_name.value = obj[idx].value;665 if(parent.opener.document.wdssetup_fm.wds_ssid)666 parent.opener.document.wdssetup_fm.wds_ssid.value = obj[idx].value;667 obj=doc.getElementsByName('bssid');668 SetHWDoc( parent.opener.document, 'wdshw', obj[idx].value ); 669 alert(MSG_APADD_REQUEST_APPLY);670 parent.opener.focus();671 parent.close();672 return;673 }674 if(!parent.opener.document.basicsetup_fm)675 {676 alert( MSG_OPENER_PAGE_MOVED );677 parent.close();678 return;679 }680 obj=doc.getElementsByName('ssid');681 parent.opener.document.basicsetup_fm.ssid.value = obj[idx].value;682 obj=doc.getElementsByName('bssid');683 parent.opener.document.basicsetup_fm.bssid.value = obj[idx].value;684 obj=doc.getElementsByName('auth_type');685 if(obj[idx].value == AUTH_AUTO)686 obj[idx].value = AUTH_OPEN;687 parent.opener.document.basicsetup_fm.auth_type.value = obj[idx].value;688 obj=doc.getElementsByName('encrypt_type');689 SetRadioValue(parent.opener.document.basicsetup_fm.encrypt_type, obj[idx].value );690 encrypt_type = obj[idx].value;691 ChangeWirelessAuth(parent.opener.document.basicsetup_fm);692 ChangeWirelessKeyInput(parent.opener.document.basicsetup_fm,1);693 parent.opener.document.getElementById('wpapsk_key').style.display = "none";694 parent.opener.document.getElementById('wep_key').style.display = "none";695 if (navigator.appName.indexOf("Microsoft") != -1)696 {697 if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)698 parent.opener.document.getElementById('wep_key').style.display = "block";699 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES)700 parent.opener.document.getElementById('wpapsk_key').style.display = "block";701 }702 else703 {704 if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)705 parent.opener.document.getElementById('wep_key').style.display = "table-row";706 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES)707 parent.opener.document.getElementById('wpapsk_key').style.display = "table-row";708 }709 if(parent.opener.document.basicsetup_fm.channel)710 {711 var channelobj;712 obj = doc.getElementsByName('channel');713 channelobj=parent.opener.document.basicsetup_fm.channel;714 for( i = 0 ; i < channelobj.length; i++ )715 {716 if( channelobj.options[i].value == obj[idx].value )717 {718 channelobj.value = obj[idx].value;719 break;720 }721 }722 if( i == channelobj.length )723 {724 /* Not found in select */725 /* Match the control channel only */726 var charr=obj[idx].value.split(".");727 for( i = 0 ; i < channelobj.length; i++ )728 {729 charr2=channelobj.options[i].value.split(".");730 if(charr2[0] == charr[0])731 {732 channelobj.value = channelobj.options[i].value;733 break;734 }735 }736 }737 }738 if(parent.opener.document.basicsetup_fm.ssid.value == '')739 {740 alert(MSG_BLANK_REQUEST_SSID);741 parent.opener.focus();742 parent.opener.document.basicsetup_fm.ssid.focus();743 }744 else if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)745 {746 alert(MSG_INVALID_REQUEST_KEY);747 parent.opener.focus();748 parent.opener.document.basicsetup_fm.wep_key1.focus();749 parent.opener.document.basicsetup_fm.wep_key1.select();750 SetRadioValue(parent.opener.document.basicsetup_fm.default_key, '1' );751 }752 else if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES)753 {754 alert(MSG_INVALID_REQUEST_KEY);755 parent.opener.focus();756 parent.opener.document.basicsetup_fm.wpapsk_key.focus();757 parent.opener.document.basicsetup_fm.wpapsk_key.select();758 }759 else760 {761 alert(MSG_INVALID_REQUEST_APPLY);762 parent.opener.focus();763 }764 parent.close();765}766function Get40MHzChannel(obj, channel)767{768 for( i = 0 ; i < obj.length; i++ )769 {770 charr=obj.options[i].value.split(".");771 if(channel == charr[0])772 return obj.options[i].value;773 }774 return obj.options[0].value;775}776function OnDBLClickChannelScanNoWizard(chan)777{778 if(!parent.opener.self.document.basicsetup_fm)779 {780 alert( MSG_OPENER_PAGE_MOVED );781 parent.close();782 return;783 }784 if(chan == -1) chan = parent.iframe_scan.document.channellist_fm.channel.value;785 alert(MSG_APPLY_REQUEST_KEY);786 if( parent.opener.self.document.basicsetup_fm.channel )787 {788 parent.opener.self.document.basicsetup_fm.channel.value = chan;789 parent.opener.self.document.basicsetup_fm.channel.focus();790 }791 parent.opener.focus();792 parent.close();793}794// wirelessconf_multibssid795function ApplyMultiBssid()796{797 var F=document.mbssid_fm;798 var obj;799 if(F.ssid.value == '')800 {801 alert(MSG_BLANK_SSID);802 F.ssid.focus();803 return;804 }805 if(F.rx_rate && (parseInt(F.rx_rate.value) > 1) && (parseInt(F.rx_rate.value) < 100))806 {807 alert(MSG_MBSSID_QOS_WARNING);808 F.rx_rate.focus();809 return;810 }811 if(F.tx_rate && (parseInt(F.tx_rate.value) > 1) && (parseInt(F.tx_rate.value) < 100))812 {813 alert(MSG_MBSSID_QOS_WARNING);814 F.tx_rate.focus();815 return;816 }817 var encrypt_type = GetRadioValue(F.encrypt_type);818 var auth_type = GetRadioValue(F.auth_type);819 // in case of mbridge ... should be added820 // security check821 if(encrypt_type == ENCRYPT_64|| encrypt_type == ENCRYPT_128)822 {823 var key_length, i,obj;824 var key_input = GetRadioValue(F.key_input);825 (encrypt_type == ENCRYPT_64)?(key_length = 5):(key_length = 13);826 if(key_input == KEY_HEX) key_length = key_length * 2;827 if(obj=CheckWEPKeyLength("wep_key",key_length))828 {829 alert(MSG_INVALID_WEP_KEY_LENGTH);830 obj.focus();831 obj.select();832 return;833 }834 if(key_input == KEY_HEX)835 {836 if(obj=CheckWEPKeyHex("wep_key",key_length))837 {838 alert(MSG_INVALID_WEP_KEY_HEXVALUE);839 obj.focus();840 obj.select();841 return;842 }843 }844 }845 else if(encrypt_type == ENCRYPT_TKIP || encrypt_type == ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES)846 {847 if(F.wpapsk_key.value.length < 8)848 {849 alert(MSG_INVALID_WPAPSK_KEY_LENGTH);850 F.wpapsk_key.focus();851 F.wpapsk_key.select();852 return;853 }854 }855 F.act.value = "add";856 F.submit();857}858var CheckStatus = 0;859function SetCheckStatus()860{861 CheckStatus = 1;862}863function ModifyMBSS(F,idx)864{865 var i, trobj;866 var obj;867 if(CheckStatus == 1) 868 {869 CheckStatus = 0;870 return;871 }872 for( i=0; ; i++)873 {874 trobj = document.getElementById('tr_'+i);875 if(!trobj) break;876 trobj.className = 'big_td';877 textobj = document.getElementById('ssid_text_'+i);878 if(!textobj) break;879 else textobj.className = 'item_text';880 textobj = document.getElementById('desc_text_'+i);881 if(!textobj) break;882 else textobj.className = 'gray_text';883 textobj = document.getElementById('run_text_'+i);884 if(!textobj) break;885 else textobj.className = 'gray_text';886 }887 trobj = document.getElementById('tr_'+idx);888 trobj.className = 'big_selected_td';889 textobj = document.getElementById('ssid_text_'+idx);890 textobj.className = 'white_text';891 textobj = document.getElementById('desc_text_'+idx);892 textobj.className = 'white_text';893 textobj = document.getElementById('run_text_'+idx);894 textobj.className = 'white_text';895 obj = document.getElementsByName('m_ssid');896 F.ssid.value = obj[idx].value;897 F.old_ssid.value = obj[idx].value;898 obj = document.getElementsByName('m_mbss_policy');899 SetRadioValue( F.mbss_policy, obj[idx].value );900 obj = document.getElementsByName('m_broadcast_ssid');901 SetRadioValue( F.broadcast_ssid, obj[idx].value );902 obj = document.getElementsByName('m_auth_type');903 F.auth_type.value = obj[idx].value;904 obj = document.getElementsByName('m_enc_type');905 SetRadioValue( F.encrypt_type, obj[idx].value );906 obj = document.getElementsByName('m_wmm');907 if(obj) SetRadioValue( F.wmm, obj[idx].value );908 obj = document.getElementsByName('m_tx_rate');909 if(obj[idx]) F.tx_rate.value = obj[idx].value;910 obj = document.getElementsByName('m_rx_rate');911 if(obj[idx]) F.rx_rate.value = obj[idx].value;912 ChangeWirelessAuth(F);913 ChangeWirelessKeyInput(F,1);914 document.getElementById('wpapsk_key').style.display = "none";915 document.getElementById('wep_key').style.display = "none";916 encrypt_type = GetValue(F.encrypt_type);917 if (navigator.appName.indexOf("Microsoft") != -1)918 display = "block";919 else920 display = "table-row";921 if(encrypt_type == ENCRYPT_64 || encrypt_type== ENCRYPT_128)922 document.getElementById('wep_key').style.display = display;923 if(encrypt_type == ENCRYPT_TKIP || encrypt_type== ENCRYPT_AES || encrypt_type== ENCRYPT_TKIPAES)924 document.getElementById('wpapsk_key').style.display = display;925 obj = document.getElementsByName('m_wepkey1');926 F.wep_key1.value = obj[idx].value;927 obj = document.getElementsByName('m_wepkey2');928 F.wep_key2.value = obj[idx].value;929 obj = document.getElementsByName('m_wepkey3');930 F.wep_key3.value = obj[idx].value;931 obj = document.getElementsByName('m_wepkey4');932 F.wep_key4.value = obj[idx].value;933 obj = document.getElementsByName('m_default_key');934 SetRadioValue(F.default_key, obj[idx].value )935 obj = document.getElementsByName('m_key_type');936 SetRadioValue( F.key_input, obj[idx].value );937 obj = document.getElementsByName('m_wpapsk');938 F.wpapsk_key.value = obj[idx].value;939 F.add_bt.value = MODIFY_OP; 940 F.add_bt.disabled = false; 941 F.cancel_bt.disabled = false; 942}943function CancelMBSS(F)944{945 F.act.value = '';946 F.submit();947}948function DelMBSS(F)949{950 var chkchk=false;951 if(!F.delchk)952 return;953 if(F.delchk.length)954 {955 for (i=0; i < F.delchk.length; i++)956 {957 if (F.delchk[i].type == 'checkbox')958 if (F.delchk[i].checked)959 chkchk = true;960 }961 }962 else if (F.delchk.checked) 963 chkchk = true;964 if (chkchk == true)965 {966 if(confirm(MSG_DEL_MBSSID_WARNING))967 {968 F.act.value = 'del';969 F.submit();970 }971 } else972 alert(MSG_SELECT_DEL_MBSS);973}974function RunMBSS(F)975{976 F.act.value = 'run';977 F.submit();978}979function ChangeWps()980{981 var f = document.wps_basic_setup_fm;982 if(GetRadioValue(f.wps_mode) == 0)983 {984 if(f.wps_auto_connect) DisableObj(f.wps_auto_connect);985 if(f.accept_pin) DisableObj(f.accept_pin);986 DisableObj(f.wps_keep_wlconf);987 if(f.wps_noti) DisableObj(f.wps_noti);988 if(f.wps_wait_time) DisableObj(f.wps_wait_time);989 }990 else991 {992 if(f.wps_auto_connect)993 {994 EnableObj(f.wps_auto_connect);995 if(GetRadioValue(f.wps_auto_connect) == 1)996 EnableObj(f.accept_pin);997 else998 DisableObj(f.accept_pin);999 }1000 EnableObj(f.wps_keep_wlconf);1001 if(f.wps_noti) EnableObj(f.wps_noti);1002 if(f.wps_wait_time) EnableObj(f.wps_wait_time);1003 }1004}1005function ChangeWPSOption()1006{1007 var F = document.wps_fm;1008 if(F.wps_status.value == 'start' )1009 {1010 DisableObj(F.wps_bt);1011 if (F.advanced_option)1012 F.advanced_option.disabled = true;1013 if (F.wps_pin)1014 F.wps_pin.disabled = true;1015 if (F.wps_pin_rb)1016 DisableRadio(F.wps_pin_rb);1017 if (F.wps_change_config)1018 F.wps_change_config.disabled = true;1019 F.pincode.disabled = true;1020 return;1021 }1022 if (F.advanced_option)1023 {1024 if(F.advanced_option.checked == true )1025 {1026 F.wps_pin.disabled = false;1027 if(F.wps_pin.checked == true ) F.pincode.disabled = false;1028 else F.pincode.disabled = true;1029 F.wps_change_config.disabled = false;1030 }1031 else1032 {1033 F.wps_pin.disabled = true;1034 F.wps_change_config.disabled = true;1035 F.pincode.disabled = true;1036 }1037 }1038}1039function WPSAddDev()1040{1041 document.wps_fm.wps_status.value= 'start';1042 document.wps_fm.submit();1043}1044function WPSNotiOption()1045{1046 var F = document.wps_basic_setup_fm;1047 if(!F.wps_noti)1048 return;1049 if (GetRadioValue(F.wps_noti) == 1)1050 EnableObj(F.wps_noti_ssid);1051 else1052 DisableObj(F.wps_noti_ssid);1053}1054function WPSConnectOption()1055{1056 var F = document.wps_fm;1057 if (GetRadioValue(F.wps_pin_rb) == 1)1058 EnableObj(F.pincode);1059 else1060 DisableObj(F.pincode);1061}1062function WPSCancelDev()1063{1064 var F;1065 F=parent.document.wps_fm;1066 F.wps_status.value="stop";1067 F.submit();1068 //parent.document.location.href = "timepro.cgi?tmenu=wirelessconf&smenu=wps&wps_status=stop";1069}1070function ApplyWPS(act)1071{1072 var F;1073 F=document.wps_basic_setup_fm;1074 F.act.value=act;1075 F.submit();1076}1077function ApplyWirelessRateControl()1078{1079 var F = document.wireless_rateset_fm;1080 F.act.value='1';1081 F.submit();1082}1083function ApplyWMMControl(val)1084{1085 var F = document.wireless_wmm_fm;1086 F.act.value=val;1087 F.submit();1088}1089function SearchDupSSID(F)1090{1091 if(F.ssid.value == '')1092 {1093 alert(MSG_BLANK_SSID);1094 F.ssid.select();1095 F.ssid.focus();1096 return;1097 }1098 document.getElementById('ssidcheck_msg').style.display = "block";1099 document.getElementById('maintable').style.display = "none";1100 check_ssid.document.check_fm.ssid.value = F.ssid.value;1101 check_ssid.document.check_fm.country.value = F.country.value;1102 // check_ssid.document.check_fm.wl_mode.value = F.wl_mode.value;1103 check_ssid.document.check_fm.submit();1104}1105function wireless_popup(F, url,name,opt)1106{1107 url += "&mode="+F.mode.value+"&country="+F.country.value+"&channel_width="+F.channel_width.value;1108 win=window.open(url,name,opt);1109 win.focus();1110}1111function ClearCursor(obj, c_color)1112{1113 if(obj)1114 {1115 obj.style.backgroundColor='';1116 obj.style.color=c_color ? c_color : '#888888';1117 }1118}1119function SetCursor(obj)1120{1121 if(obj)1122 {1123 obj.style.backgroundColor='#C9D5E9';1124 obj.style.color='#000000';1125 }1126}1127function ClickTr(obj)1128{1129 var prev_id = document.main_form.click_id.value;1130 var prev_bgcolor=document.main_form.click_bg.value;1131 var click_id = obj.id;1132 if(prev_id == click_id) return;1133 if(prev_id)1134 {1135 document.getElementById(prev_id).style.backgroundColor = prev_bgcolor;1136 parent.document.getElementById(prev_id+"_table").style.display = "none";1137 }1138 parent.document.getElementById(click_id+"_table").style.display = "block";1139 document.main_form.click_id.value = click_id;1140 document.main_form.click_bg.value = obj.style.backgroundColor;1141 SetCursor(obj);1142 parent.document.wireless_params_fm.act.value = obj.id;1143}1144function ApplyWirelessParams2()1145{1146 var F=document.wireless_params_fm;1147 if((F.act.value == 'tx_power') && ((F.tx_power.value > 100 ) || (F.tx_power.value < 1 )))1148 {1149 alert(DESC_INVALID_TX_POWER);1150 F.tx_power.focus();1151 return;1152 }1153 else if((F.act.value == 'rts') && ((F.rts.value > 2347 ) || (F.rts.value < 1 )))1154 {1155 alert(DESC_INVALID_RTS_THRESHOLD);1156 F.rts.focus();1157 return;1158 }1159 else if((F.act.value == 'frag') && ((F.frag.value > 2346 ) || (F.frag.value < 256 )))1160 {1161 alert(DESC_INVALID_FRAG_THRESHOLD);1162 F.frag.focus();1163 return;1164 }1165 else if((F.act.value =='beacon_interval') && ((F.beacon.value > 1024 ) || (F.beacon.value < 50 )))1166 {1167 alert(DESC_INVALID_BEACON_INTERVAL);1168 F.beacon.focus();1169 return;1170 }1171 else if((F.act.value =='dynamic_channel') && (GetValue(F.dynamic_channel) == 1) && ((F.dcs_period_hour.value < 1 ) || (F.dcs_period_hour.value > 100 )))1172 {1173 alert(DESC_INVALID_DCS_PERIOD);1174 F.dcs_period_hour.select();1175 F.dcs_period_hour.focus();1176 return;1177 }1178 F.submit();1179}1180function ChangeWLParams2()1181{1182 var F=document.wireless_params_fm;1183 if(F.dynamic_channel)1184 {1185 if(GetValue(F.dynamic_channel) == 1)1186 EnableObj(F.dcs_period_hour);1187 else1188 DisableObj(F.dcs_period_hour);1189 }1190}1191function ClickEveryDay(F)1192{1193 if(F.everyday.checked == true)1194 {1195 DisableObj(F.mon);1196 DisableObj(F.tue);1197 DisableObj(F.wed);1198 DisableObj(F.thu);1199 DisableObj(F.fri);1200 DisableObj(F.sat);1201 DisableObj(F.sun);1202 }1203 else1204 {1205 EnableObj(F.mon);1206 EnableObj(F.tue);1207 EnableObj(F.wed);1208 EnableObj(F.thu);1209 EnableObj(F.fri);1210 EnableObj(F.sat);1211 EnableObj(F.sun);1212 }1213}1214function ClickAllTime(F)1215{1216 if(F.always24.checked == true)1217 {1218 DisableObj(F.shour);1219 DisableObj(F.smin);1220 DisableObj(F.ehour);1221 DisableObj(F.emin);1222 }1223 else1224 {1225 EnableObj(F.shour);1226 EnableObj(F.smin);1227 EnableObj(F.ehour);1228 EnableObj(F.emin);1229 }1230}1231function ClickSchedFlag()1232{1233 var F=document.wireless_sched_fm;1234 if(GetValue(F.wifi_sched_flag) == 'on')1235 EnableObj(F.wifi_sched_policy);1236 else1237 DisableObj(F.wifi_sched_policy);1238}1239function WifiScheduleResetAll(F)1240{1241 F.everyday.checked=false;1242 F.mon.checked=false;1243 F.tue.checked=false;1244 F.wed.checked=false;1245 F.thu.checked=false;1246 F.fri.checked=false;1247 F.sat.checked=false;1248 F.sun.checked=false;1249 F.always24.checked=false;1250 F.shour.value="";1251 F.ehour.value="";1252 F.smin.value="";1253 F.emin.value="";1254 F.add_bt.style.display = '';1255 F.modify_bt.style.display = 'none';1256 F.cancel_bt.style.display = 'none';1257 EnableObj(F.mon);1258 EnableObj(F.tue);1259 EnableObj(F.wed);1260 EnableObj(F.thu);1261 EnableObj(F.fri);1262 EnableObj(F.sat);1263 EnableObj(F.sun);1264 EnableObj(F.shour);1265 EnableObj(F.smin);1266 EnableObj(F.ehour);1267 EnableObj(F.emin);1268}1269function UpdateWifiSched(act)1270{1271 var F=document.wireless_sched_fm;1272 var F2=sched_frame.main_form;1273 F2.act.value = act;1274 F2.add_val.value = "1,"; /* flag */1275 if(1276 (F.everyday.checked == false) 1277 && (F.sun.checked == false) 1278 && (F.mon.checked == false) 1279 && (F.tue.checked == false) 1280 && (F.wed.checked == false) 1281 && (F.thu.checked == false) 1282 && (F.fri.checked == false) 1283 && (F.sat.checked == false) 1284 )1285 {1286 alert(SELECT_DAY_DESC);1287 return;1288 }1289 if(F.everyday.checked == true)1290 F2.add_val.value += "1,0,0,0,0,0,0,0,";1291 else1292 {1293 F2.add_val.value += "0,";1294 F2.add_val.value += (F.sun.checked == true)?"1,":"0,";1295 F2.add_val.value += (F.mon.checked == true)?"1,":"0,";1296 F2.add_val.value += (F.tue.checked == true)?"1,":"0,";1297 F2.add_val.value += (F.wed.checked == true)?"1,":"0,";1298 F2.add_val.value += (F.thu.checked == true)?"1,":"0,";1299 F2.add_val.value += (F.fri.checked == true)?"1,":"0,";1300 F2.add_val.value += (F.sat.checked == true)?"1,":"0,";1301 }1302 if(F.always24.checked == true)1303 F2.add_val.value += "1,0,0,0,0";1304 else1305 {1306 F2.add_val.value += "0,";1307 if(checkRange(F.shour.value,0,23))1308 {1309 F.shour.select();1310 F.shour.focus();1311 alert(INVALID_HOUR_TEXT);1312 return;1313 }1314 if(checkRange(F.smin.value,0,59))1315 {1316 F.smin.select();1317 F.smin.focus();1318 alert(INVALID_MIN_TEXT);1319 return;1320 }1321 if(checkRange(F.ehour.value,0,23))1322 {1323 F.ehour.select();1324 F.ehour.focus();1325 alert(INVALID_HOUR_TEXT);1326 return;1327 }1328 if(checkRange(F.emin.value,0,59))1329 {1330 F.emin.select();1331 F.emin.focus();1332 alert(INVALID_MIN_TEXT);1333 return;1334 }1335 F2.add_val.value += F.shour.value+","+F.smin.value+","+F.ehour.value+","+F.emin.value;1336 }1337 //alert(F2.add_val.value);1338 WifiScheduleResetAll(F);1339 F2.submit();1340}1341function ClickRmCheck()1342{1343 if (!e) var e = window.event;1344 e.cancelBubble = true;1345 if (e.stopPropagation) e.stopPropagation(); 1346}1347function ClickWifiSchedule(obj)1348{1349 var prev_id = document.main_form.click_id.value;1350 var prev_bgcolor=document.main_form.click_bg.value;1351 var click_id = obj.id;1352 if(prev_id != click_id) 1353 {1354 if(prev_id)1355 document.getElementById(prev_id).style.backgroundColor = prev_bgcolor;1356 document.main_form.click_id.value = click_id;1357 document.main_form.click_bg.value = obj.style.backgroundColor;1358 SetCursor(obj);1359 }1360 var F=parent.document.wireless_sched_fm;1361 var valobj=document.getElementById(obj.id+'_v');1362 var sched_arr = valobj.value.split(",");1363 //alert(valobj.value);1364 WifiScheduleResetAll(F);1365 document.main_form.sched_id.value = obj.id;1366 F.everyday.checked = (sched_arr[1]=='1')?true:false;1367 F.sun.checked = (sched_arr[2]=='1')?true:false;1368 F.mon.checked = (sched_arr[3]=='1')?true:false;1369 F.tue.checked = (sched_arr[4]=='1')?true:false;1370 F.wed.checked = (sched_arr[5]=='1')?true:false;1371 F.thu.checked = (sched_arr[6]=='1')?true:false;1372 F.fri.checked = (sched_arr[7]=='1')?true:false;1373 F.sat.checked = (sched_arr[8]=='1')?true:false;1374 F.always24.checked = (sched_arr[9]=='1')?true:false;1375 if(F.always24.checked == false)1376 {1377 F.shour.value = sched_arr[10];1378 F.smin.value = sched_arr[11];1379 F.ehour.value = sched_arr[12];1380 F.emin.value = sched_arr[13];1381 }1382 ClickEveryDay(F);1383 ClickAllTime(F);1384 F.add_bt.style.display = 'none';1385 F.modify_bt.style.display = '';1386 F.cancel_bt.style.display = '';1387}1388function CheckAllSchedule(F)1389{1390 objs=sched_frame.document.getElementsByName('rmcheck');1391 for( i = 0 ; i < objs.length; i++)1392 objs[i].checked=F.checkall.checked;1393}1394function InitWifiSchedule(id)1395{1396 var prev_id = document.main_form.click_id.value;1397 var prev_bgcolor=document.main_form.click_bg.value;1398 var obj = document.getElementById(id);1399 var click_id = obj.id;1400 if(prev_id == click_id) 1401 return;1402 if(prev_id)1403 document.getElementById(prev_id).style.backgroundColor = prev_bgcolor;1404 document.main_form.click_id.value = click_id;1405 document.main_form.click_bg.value = obj.style.backgroundColor;1406 SetCursor(obj);1407}1408function CancelWifiSchedule()1409{1410 var F = document.wireless_sched_fm;1411 F.act.value = '';1412 F.submit();1413}1414function RemoveWifiSchedule()1415{1416 var F=sched_frame.main_form;1417 F.act.value = 'remove';1418 F.submit();1419}...

Full Screen

Full Screen

symmetric.py

Source:symmetric.py Github

copy

Full Screen

1# coding: utf-82from __future__ import unicode_literals, division, absolute_import, print_function3from . import backend4_backend = backend()5if _backend == 'osx':6 from ._osx.symmetric import (7 aes_cbc_no_padding_decrypt,8 aes_cbc_no_padding_encrypt,9 aes_cbc_pkcs7_decrypt,10 aes_cbc_pkcs7_encrypt,11 des_cbc_pkcs5_decrypt,12 des_cbc_pkcs5_encrypt,13 rc2_cbc_pkcs5_decrypt,14 rc2_cbc_pkcs5_encrypt,15 rc4_decrypt,16 rc4_encrypt,17 tripledes_cbc_pkcs5_decrypt,18 tripledes_cbc_pkcs5_encrypt,19 )20elif _backend == 'win' or _backend == 'winlegacy':21 from ._win.symmetric import (22 aes_cbc_no_padding_decrypt,23 aes_cbc_no_padding_encrypt,24 aes_cbc_pkcs7_decrypt,25 aes_cbc_pkcs7_encrypt,26 des_cbc_pkcs5_decrypt,27 des_cbc_pkcs5_encrypt,28 rc2_cbc_pkcs5_decrypt,29 rc2_cbc_pkcs5_encrypt,30 rc4_decrypt,31 rc4_encrypt,32 tripledes_cbc_pkcs5_decrypt,33 tripledes_cbc_pkcs5_encrypt,34 )35else:36 from ._openssl.symmetric import (37 aes_cbc_no_padding_decrypt,38 aes_cbc_no_padding_encrypt,39 aes_cbc_pkcs7_decrypt,40 aes_cbc_pkcs7_encrypt,41 des_cbc_pkcs5_decrypt,42 des_cbc_pkcs5_encrypt,43 rc2_cbc_pkcs5_decrypt,44 rc2_cbc_pkcs5_encrypt,45 rc4_decrypt,46 rc4_encrypt,47 tripledes_cbc_pkcs5_decrypt,48 tripledes_cbc_pkcs5_encrypt,49 )50__all__ = [51 'aes_cbc_no_padding_decrypt',52 'aes_cbc_no_padding_encrypt',53 'aes_cbc_pkcs7_decrypt',54 'aes_cbc_pkcs7_encrypt',55 'des_cbc_pkcs5_decrypt',56 'des_cbc_pkcs5_encrypt',57 'rc2_cbc_pkcs5_decrypt',58 'rc2_cbc_pkcs5_encrypt',59 'rc4_decrypt',60 'rc4_encrypt',61 'tripledes_cbc_pkcs5_decrypt',62 'tripledes_cbc_pkcs5_encrypt',...

Full Screen

Full Screen

caesar.py

Source:caesar.py Github

copy

Full Screen

...31 s_rotated = s_rotated + s_encrypt32 else:33 s_rotated = s_rotated + i34 return s_rotated35def encrypt(text, rot):36 x = rotate_character(text, rot)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var crypto = require('redwood-crypto');2var encrypted = crypto.encrypt("test");3console.log(encrypted);4var crypto = require('redwood-crypto');5var decrypted = crypto.decrypt("test");6console.log(decrypted);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { encryptPassword } from '@redwoodjs/auth'2const encryptedPassword = encryptPassword('password')3const decryptedPassword = decryptPassword(encryptedPassword)4- [encryptPassword](#encryptpassword)5 - [Parameters](#parameters)6- [decryptPassword](#decryptpassword)7 - [Parameters](#parameters-1)

Full Screen

Using AI Code Generation

copy

Full Screen

1const redwood = require('@redwoodjs/api');2const { encrypt } = redwood.crypto;3const { decrypt } = redwood.crypto;4const encrypted = encrypt('Hello World');5console.log(encrypted);6console.log(decrypt(encrypted));7### `encrypt(plaintext)`8### `decrypt(ciphertext)`9Contributions are welcome! Please see our [contributing guidelines](

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run redwood automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful