密码生成器C实现

#include <stdio.h>

#include <string.h>

#include <time.h>

//const char lower_chars[] = "abcdefghijklmnopqrstuvwxyz";

//const char upper_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

//const char number_chars[] = "0123456789";

const char lower_chars[] = "abcdefghijkmnpqrstuvwxyz"; // no l or o

const char upper_chars[] = "ABCDEFGHJKLMNPQRSTUVWXYZ"; // no I or O

const char number_chars[] = "23456789"; // no 1 or 0

const char special_chars[] = "[email protected]#$%^&*()-=_+[]{};:‘\"<>,.?/";

const int _ks_pass_len = 17;

void mkpass(char pass[_ks_pass_len+1])

{

int i = 0, j = 0, k = 0,n = 0;

n = _ks_pass_len/4;

for (; i < n; i++)

{

pass[i] = lower_chars[rand()%(strlen(lower_chars))];

pass[i+n] = upper_chars[rand()%(strlen(upper_chars))];

pass[i+2*n] = number_chars[rand()%(strlen(number_chars))];

pass[i+3*n] = special_chars[rand()%(strlen(special_chars))];

}

j = _ks_pass_len - 4*n;

for (i = 0; i<j; i++)

{

pass[i+4*n] = special_chars[rand()%(strlen(special_chars))];

}

//字符乱序

for (i = 0; i < 32; i++)

{

j = rand()%(_ks_pass_len);

k = pass[j];

pass[j] = pass[i%_ks_pass_len];

pass[i%_ks_pass_len] = k;

}

pass[_ks_pass_len] = ‘\0‘;

}

int _tmain(int argc, _TCHAR* argv[])

{

srand(time(0));

char szPass[_ks_pass_len+1];

for (int i=0; i<16; i++)

{

mkpass(szPass);

printf("%s\n",szPass);

}

return 0;

}

时间: 2024-10-10 05:28:07

密码生成器C实现的相关文章

Python密码生成器

密码生成器: 密码格式为:密码+空格+字符(随机产生自定义长度) 10.1.1.1 %V!Z{#2)9G,- 10.1.1.2 xWIg;9zIdn?} 10.1.1.3 )[email protected] 10.1.1.4 sX<_?Z.<yd9& 10.1.1.5 Y{Zy[ym6z.,O 10.1.1.6 [qbXiBt37Rcu 10.1.1.7 )Xs7t6[^NlDP 10.1.1.8 H4CwO!!W8fAZ 10.1.1.9 #;VXI4lgawIx 10.1.1.1

密码生成器

诗词密码生成器 ,地址: http://saas.janusec.com/password/generator (我们不生产无意义的乱码!只让密码满足强度要求,又变得有意义.有趣.好记!) 生成的密码举例: 娉娉袅袅十三余,豆蔻梢头二月初.(Ppnn13yDkstFeb.c) 飞流直下三千尺,疑似银河落九天.(Flzx3000cY4yhl9t) 池上碧苔三四点,叶底黄鹂一两声.(Csbt34.Ydhl12s) 一道残阳铺水中,半江瑟瑟半江红.(1dcypsz1/2jss1/2jh) 停车坐爱枫林

密码生成器是如何做的?

微软GUID JUID 还有vpn密码生成器 最后还要做一个系统启动的服务

python2.7写的图形密码生成器

#coding:utf8import random,wxdef password(event): a = [chr(i) for i in range(97,123)] b = [chr(i) for i in range(65,91)] c = ['0','1','2','3','4','5','6','7','8','9'] d = ['!','@','#','$','%','^','&','*','(',')','=','_','+','/','?'] set1 = a + b + c +

【Python】密码生成器

import random import string print("欢迎使用密码生成器") def passlength(): print("你想要多长的密码:") global passlen try: input1=input() passlen=int(input1) except: print("请输入一个数字") passlength() if passlen<5: print("太短了??") passle

python3 密码生成器

用random模块实现按照要求生成一定个数和一定位数的密码: #Author by Andy #_*_ coding:utf-8 _*_ import random checkcode='' code='''[email protected]#%&()*"{}''' code_len=int(input('请输入密码长度:')) code_count=int(input('请输入密码个数:')) count = 0 while count < code_count: checkco

python -- 密码生成器

小Q:中庭地白树栖鸦,冷露无声湿桂花:今夜月明人尽望,不知秋思落谁家? 王建<十五夜望月> 两个密码生成代码实例 ============================================================= #!/usr/bin/python #-*- coding:utf8 -*- from random import randrange, sample password_list = ['z','y','x','w','v','u','t','s','r','

Golang实现一个密码生成器

小地鼠防止有人偷他的果实,在家里上了一把锁.这个锁怎么来的呢?请往下看.. package main import ( "flag" "fmt" "math/rand" "time" ) var ( length int charset string ) const ( NUmStr = "0123456789" CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde

密码生成器(python)

#!/usr/bin/env python import random import string import sys similar_char = '0OoiI1LpP' upper = ''.join(set(string.uppercase) - set(similar_char)) lower = ''.join(set(string.lowercase) - set(similar_char)) symbols = '!#$%&\*+,-./:;[email protected]^_