dvbbs
收藏本页
联系我们
论坛帮助
dvbbs

>> Fortran语言开发经验交流
搜一搜更多此类问题 
Fortran中文网Fortran中文网—Fortran语言经验交流Fortran语言开发经验交流 → [原创]计算密码强度(按每秒1千万次试码速度计算)

您是本帖的第 4137 个阅读者
树形 打印
标题:
[原创]计算密码强度(按每秒1千万次试码速度计算)
fortranboy
帅哥哟,离线,有人找我吗?
等级:论坛游民
文章:18
积分:682
门派:无门无派
注册:2006年10月3日
楼主
 用支付宝给fortranboy付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给fortranboy

发贴心情
[原创]计算密码强度(按每秒1千万次试码速度计算)
点击浏览该文件
$freeform
! 计算密码强度(按每秒1千万次试码速度计算)
! shizhengwei@yahoo.com.cn
use msflib
integer s(5),n
real*8 t,d
parameter (k=125,y=1d7*365*24*3600)
character a
character*4 h
character*(k) code
s=0
write(*,'(2a)') char(13),'计算密码强度(按每秒1千万次试码速度计算)'
write(*,'(2a,\)') char(13),'请输入要测试的密码:'
read(*,'(a)') code
n=len_trim(code)
do i=1,n                                              ! 分析字符范围
   a=code(i:i)
   if(a.ge.'0'.and.a.le.'9') then                     ! 包含数字
      s(1)=10
   else if(a.ge.'a'.and.a.le.'z') then                ! 包含小写字母
      s(2)=26
   else if(a.ge.'A'.and.a.le.'Z') then                ! 包含大写字母
      s(3)=26
   else if(a.ge.char(161).and.a.le.char(254)) then    ! 包含汉字
      s(4)=94
   else                                               ! 包含空格和其它字符
      s(5)=33
   end if
end do
t=0d0
do i=1,5                                              ! 累加字符种数
   t=t+s(i)
end do
t=t**n/y                                              ! 计算强度并输出
write(*,'(2a,\)') char(13),'密码破解强度:'
if(t.lt.1) then
   t=t*365
   if(t.lt.1) then
      call t2h(t*24,h)
      if(h.eq.'0') then
         write(*,'(2a)') '不足1小时'
      else
         write(*,'(2a)') trim(h),'小时'
      end if
   else
      call t2h(t,h)
      write(*,'(2a)') trim(h),'天'
   end if
else if(t.ge.1.and.t.lt.1d4) then
   call t2h(t,h)
   write(*,'(2a)') trim(h),'年'
else if(t.ge.1d4.and.t.lt.1d6) then
   call t2h(t/1d4,h)
   write(*,'(2a)') trim(h),'万年'
else if(t.ge.1d6) then
   write(*,'(a)') '不少于100万年'
end if
write(*,'(/,2a)') char(13),'按任意键结束程序'
a=getcharqq()
end
subroutine t2h(t,h)                                   ! 数字转换为字符
real*8 t
character*4 h
write(h,'(i4)') int(t)
n=verify(h,' ')
if(n.gt.1) h=h(n:4)
end
[此贴子已经被作者于2012-8-9 9:00:08编辑过]
ip地址已设置保密
2012/8/8 10:16:33
fortranboy
帅哥哟,离线,有人找我吗?
等级:论坛游民
文章:18
积分:682
门派:无门无派
注册:2006年10月3日
2
 用支付宝给fortranboy付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给fortranboy

发贴心情
对程序作了更新,重新上传。
ip地址已设置保密
2012/8/9 9:01:11

 2   2   1/1页      1    
网上贸易 创造奇迹! 阿里巴巴 Alibaba
Powered By Dvbbs Version 7.1.0 Sp1
Copyright ©2005 - 2008 www.fortran.cn
页面执行时间 0.10938 秒, 5 次数据查询
京ICP备05056801号