nodejs 加密算法 JavaScriptNodeJS生成随机码

简介:JavaScriptNodeJS生成随机码生成随机码及密码函数及代码/***数字〗字符串*@param{*}length*@returns*/functionrandomWord1(length){//指定长
【菜叶百科解读】
/** * 数字字→符串 * @param {*} length * @returns */ function randomWord1(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = ''; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 大写字母 数字字符串 * * @param {} length * @returns */ function randomWord2(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 小写字母 数字字符串 * * @param {} length * @returns */ function randomWord3(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = 'abcdefghijklmnopqrstuvwxyz'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 大小写字▓母 数字字符串 * * @param {*} length * @returns */ function randomWord4(length) { //指定长度: 默认长度8位 length || (length = 8); //指定数☆字范围, const numbers = '0123456789'; //指定字母∩范围,(也可以指定字符或者∮小写字母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 常用特殊字▂符 大小╳写字母 数字字符串 * * @param {*} length * @returns */ function randomWord5(length) { //指定长度: 默认长度8位 length || (length = 8); //指定◥数字范围, const numbers = '0123456789'; //指定字母范围,(也可以指定字符或者小写字』母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; //指定◣特殊字符 const specials = "~@#$%^&*()/.,"; let total = numbers letters specials; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 特殊字符 大小写字□母 数字字符串 * * @param {*} length * @returns */ function randomWord6(length) { //指定长度: 默认长度8位 length || (length = 8); //指定数◣字范围, const numbers = '0123456789'; //指定字母范围,(也可以指定字符或者小写字母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; //指定特殊字符 const specials = "!#$%&'()* ,-./:;<=>?@[\]^_`{|}~"; let total = numbers letters specials; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } // 数字【04970152848】 console.log("randomWord1 = ", randomWord1(11)); // 数字 大写字母【CE6532REAT7】 console.log("randomWord2 = ", randomWord2(11)); // 数字 小写字母【6a23t040nhu】 console.log("randomWord3 = ", randomWord3(11)); // 数字 大小写字母【0AC9U0t2CsI】 console.log("randomWord4 = ", randomWord4(11)); // 常用特殊字母 数字 大小写字母【hpj4~Catjb4】 console.log("randomWord5 = ", randomWord5(32)); // 特殊字母 数字 大小写字母【5Ra%x]N^8H】 console.log("randomWord6 = ", randomWord6(11));,我来为大家讲解一下关于nodejs 加密算法?跟着小编一起来看一看吧!
nodejs 加密算法
生成随机码及密码 函数及代码/** * 数字字符串 * @param {*} length * @returns */ function randomWord1(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = ''; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 大写字母 数字字符串 * * @param {} length * @returns */ function randomWord2(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 小写字母 数字字符串 * * @param {} length * @returns */ function randomWord3(length) { //指定长度: 默认长度8位 length || (length = 8); const numbers = '0123456789'; const letters = 'abcdefghijklmnopqrstuvwxyz'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 大小写字母 数字字符串 * * @param {*} length * @returns */ function randomWord4(length) { //指定长度: 默认长度8位 length || (length = 8); //指定数字范围, const numbers = '0123456789'; //指定字母范围,(也可以指定字符或者小写字母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let total = numbers letters; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 常用特殊字符 大小写字母 数字字符串 * * @param {*} length * @returns */ function randomWord5(length) { //指定长度: 默认长度8位 length || (length = 8); //指定数字范围, const numbers = '0123456789'; //指定字母范围,(也可以指定字符或者小写字母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; //指定特殊字符 const specials = "~!@#$%^&*()/.,"; let total = numbers letters specials; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } /** * 特殊字符 大小写字母 数字字符串 * * @param {*} length * @returns */ function randomWord6(length) { //指定长度: 默认长度8位 length || (length = 8); //指定数字范围, const numbers = '0123456789'; //指定字母范围,(也可以指定字符或者小写字母) const letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; //指定特殊字符 const specials = "!#$%&'()* ,-./:;<=>?@[\]^_`{|}~"; let total = numbers letters specials; let result = ''; while (length > 0) { length--; result = total[Math.floor(Math.random() * total.length)]; } return result; } // 数字【04970152848】 console.log("randomWord1 = ", randomWord1(11)); // 数字 大写字母【CE6532REAT7】 console.log("randomWord2 = ", randomWord2(11)); // 数字 小写字母【6a23t040nhu】 console.log("randomWord3 = ", randomWord3(11)); // 数字 大小写字母【0AC9U0t2CsI】 console.log("randomWord4 = ", randomWord4(11)); // 常用特殊字母 数字 大小写字母【hpj4~Catjb4】 console.log("randomWord5 = ", randomWord5(32)); // 特殊字母 数字 大小写字母【5Ra%x]N^8H】 console.log("randomWord6 = ", randomWord6(11));
声明:本文内容仅代表作者个人观点,与本站立场无关。如有内容侵犯您的合法权益,请及时与我们√联系,我们将第一时间安排处理
-
库仑定律的基本内容和适用条件↓ 库仑定律的理解及其应用
库仑定律的理解及其应用【常用规律、公式】库仑定律1.内容:真空中两个静止点电荷之间的相互作用力,与它们的电
释疑解惑 1人浏览 2023-05-18 -
axios跟ajax请求的结果不一致 数据请〗求中AjaxFetch以及Axios的区别
数据请求中AjaxFetch以及Axios的区别作者:程序喵大家应该都知道C17引入了variant,这篇文章我们来研究下它究竟有啥用
释疑解惑 1人浏览 2023-05-18 -
显卡是如何打造的 造一块显卡有多难
造一块显卡有多难短短不到一个月,就经历了从两眼放光,到两眼一黑的大起大落能让机哥着了魔一样挂念的,到底
释疑解惑 1人浏览 2023-05-16 -
炉石手机端一到拉锯战就卡死 手机端←闪退现象严重
手机端闪退现象严重《炉石传说》作为一款以卡牌组合对战为特色的游戏,一直以来被大批的玩家所钟爱,很多人都
释疑解惑 0人浏览 2023-05-15 -
skyhon是什么牌子的手机 ASLL举行ζ新品发布会
ASLL举行新品发布会生意场上素有“金九银十”的说法,手机圈也不例外,每年9月,都是各大品牌新机集中上市之时在
释疑解惑 0人浏览 2023-05-15 -
华为新旗舰荣耀6 精琢细磨尽显科技之ω 美
精琢细磨尽显科技之美(文/少先男队员)上一期给大家介绍完华为荣耀6外观后,笔者并没有在第一时间出一篇测评文
释疑解惑 0人浏览 2023-05-15 -
鸣人的所有形态大招手游 让你秒变孙悟空和鸣人
让你秒变孙悟空和鸣人分身,是一件多么神︾奇的事情,中外影视、文学作品都有描述,比如中国古典文学《西游记》
释疑解惑 1人浏览 2023-05-15 -
linux 单字节读写 互斥 嵌入式Linux编程程序员小白不懂的进程
嵌入式Linux编程程序员小白不懂的进程所有学嵌入式Linux系统的看过来了,以下内容是每一位想学习Linux嵌入式系统想
释疑解惑 0人浏览 2023-05-14 -
如何解决电脑越来越慢的问题 IT小百科之电脑用久了
IT小百科之电脑用久了
释疑解惑 0人浏览 2023-05-14 -
怎么把云端弄成本地 云端交流
云端交流1、下载安装美图秀秀2、打开,点击“视频剪辑”点击“视频剪辑”3、选定要编辑的视频,出现“开始编辑
释疑解惑 0人浏览 2023-05-14