- @echo off&setlocal enabledelayedexpansion
- rem 生成方阵
- set "codes=a b c d e f g h i j k l m n o p q r s t u v w x y z"
- set "code=%codes: =%"
- for %%i in (%codes%) do set /a n+=1&set "_!n!=%%i"
- set "_a=%code%"
- for /l %%i in (1,1,25) do (
- set "code=!code:~1!!code:~,1!"
- set "_!code:~,1!=!code!"
- )
- echo.&set /p str=请输入密文:
- echo.&set /p pss=请输入密匙:
- echo.&set /p=解密的明文:<nul
- :again
- set "a1=%str:~,1%"&set "a2=%pss:~,1%"
- set "str=%str:~1%"&set "pss=%pss:~1%%a2%"
- set "var=!_%a2%!"&set "n=0"&call :lp
- if defined str goto again
- pause>nul&goto :eof
- :lp
- set "a=%var:~,1%"&set /a n+=1
- if /i "%a%" equ "%a1%" set /p=!_%n%!<nul&goto :eof
- set "var=%var:~1%"
- goto lp
复制代码
|