回复 34# CrLf
嗯....要想一个复杂的判断输入是否正确的方式,比如先给密码套上几层算法,比如凯撒什么的...
群友凡心写过的一个脚本,不过据他所说算法尚有缺陷导致密码不唯一- :::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::本程序主要功能
- :: 实现一个密码验证,当然是不容易破解的密码验证
- :: 密码验证的算法总有被破解的时候
- :: 能给作者带来成就的是在于寻找算法的过程
- ::
- ::code by 凡心 2011-8-24
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-
- @echo off
- color 0e
- mode con: cols=70 lines=6
- set im=echo I'm here!
- set try=3
- set "delay=for /l %%^%^%a in (1 1 2000) do echo.^^>nul"
- :res
- set col=07
- set a=0
- set/p mima=Please input password:
- set code=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz
- set code1=%code%
- call :cod
- call :word
- for /f "delims=" %%i in ('call call echo %%%%m%o_o%%%%%') do (
- color 07
- call :ts %%i
- )
- ::%im% And wrong here!
- goto err
- pause
- goto :eof
-
-
- :wro
- set /a a+=1
- call call set %mima:~0,1%=%%%%%%%mima:~0,1%%%%%%%
- call call set %mima:~3,1%=%%%%%%%mima:~3,1%%%%%%%
- call call set %mima:~4,1%=%%%%%%%mima:~4,1%%%%%%%
- if %a% lss 2 goto wro
- call call :%%%mima:~0,1%%%%%%mima:~3,1%%%%%%mima:~4,1%%% 2>nul
-
- :err
- cls
- set /a try-=1
- call :col
- color 0c
- echo.
- echo Now! You are here, that's the password is wrong!! Thy again!
- echo You will have %try% times to input the password!
- if %try% gtr 0 (goto res) else (color 0c&echo BAD NEWS! SAY BAY TO YOU NOW!!)
- pause>nul
- goto :eof
-
- :ts
- set aa=%1
- call set _aa=%%aa:ai= %code1:~5,1%%code1:~23,1% %%
- for %%j in (%_aa%) do (if "%%j" equ "%code1:~5,1%%code1:~23,1%" (goto :wro))
- goto :eof
-
- :word
-
- for /l %%i in (0,1,61) do call set %%code:~0,1%%=%%code:~1,1%%&call set code=%%code:~1%%
- call set %%D%%=P
- call set %%M%%=K
- call set %%Y%%=G
- call set %%i%%=c
- call set %%m%%=l
- call set %%w%%=x
- call set %%r%%=b
- goto :eof
-
- :col
- if %col% equ 0c (color %col%&set col=07) else (color %col%&set col=0c)
- %delay%
- goto :eof
-
- :cod
- shift /1
- set /a oo_1=%random%%%8+1
- set /a oo_2=%random%%%8+1
- set /a o_o="((%oo_1%^%oo_2%)|255)"
- set /a o_o="(0%o_o%)>>3"
- set m%o_o%=mima
-
- goto :eof
-
- :end
- cls
- mode con: cols=55 lines=4
- echo.
- echo Congratulates! Your have got the password!
- call :col
- set /a n+=1
- if %n% lss 30 goto end
- pause>nul
- exit
- goto:eof
-
- :p
- pause
- goto :eof
复制代码
|