China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-02 23:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Mini Game]Let's Decrypt Batch Processing Encryption Passwords View 1,464 Replies 10
Original Poster Posted 2006-12-31 18:05 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
### Reference Materials
Batch Code for Calculating String Length to Check for Errors

Hehe, see who can figure out the password. The last line is the password. You can delete this line and then execute it to create your own password.


@ECHO OFF
:TOP
SETLOCAL ENABLEDELAYEDEXPANSION
SET A_X=9
SET B_Y=9
SET C_Z=9
SET BOOT=1
SET BASE=%RANDOM%
CALL :CRY
IF NOT "%CRY%" == "" SET BOOT=0&&CALL :IN
SET DIC=abcdefghijklmnopqrstuvwxyz0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ

CALL :LOS %DIC%
SET DL=%LOS%&&SET /A IDE=%LOS%%%9
IF %LOS% GTR 120 CLS&&ECHO Dictionary too long....&&GOTO END
IF NOT "%IDE%" == "0" ECHO Dictionary setting error&&GOTO END
:inp
IF "%BOOT%" == "1" (
SET MSG0=Start creating new password...&&SET MSG=Please enter new password&&SET MSG9=Creating password.
) ELSE SET MSG0=This document has password protection...&&SET MSG=Please enter&&SET MSG9=Verifying password.
ECHO.
ECHO Password dictionary (password length cannot exceed 40 characters, dictionary length not exceed 120 characters):&&ECHO %DIC%
ECHO Case-sensitive, cannot set characters or spaces other than in the dictionary&&ECHO.
ECHO %MSG0%
:inp1
SET /P PWS="%MSG% PWS:>"
ECHO %PWS%|findstr /r "">nul&&GOTO INP
IF "%BOOT%" == "1" (
SET /P FWS="Enter again PWS:>"
IF NOT "%PWS%" == "!FWS!" (
SET MSG=The two entries are different. Please enter new password
GOTO INP1)
)
SET/P=%MSG9%<nul
CALL :LOS %PWS%
SET PL=%LOS%&&IF %LOS% GTR 40 ECHO Password length cannot exceed 40&&pause&&CLS&&GOTO TOP
SET NPL=%PL%

:calc
IF %NPL% GEQ %DL% SET /A NPL=%NPL%-%DL%&&GOTO CAL
SET /A HPL=%DL%-%NPL%
CALL :CONVERSE 0 %NPL% %NPL% %HPL%
CALL :CONVERSE -%NPL% %NPL% 0 -%NPL%

SET /A HDL=(%DL%-%DL%%%2)/2
SET ADL=!NDIC:~0,%HDL%!&&SET BDL=!NDIC:~%HDL%!&&SET NDIC=
FOR /L %%i IN (0,1,%HDL%) DO SET NDIC=!NDIC!!BDL:~%%i,1!!ADL:~%%i,1!

FOR /L %%z IN (0,1,%C_Z%) DO (
FOR /L %%y IN (0,1,%B_Y%) DO (
FOR /L %%x IN (0,1,%A_X%) DO (
SET /a WD=1%%x%%y%%z%%%DL%
CALL :TEXT !WD!
SET _d_%%x%%y%%z=!TEXT!)
)
SET/P=.<nul)
::set _d_>1.txt&&goto chk


:create
FOR /L %%i IN (0,1,%NNPL%) DO (
FOR /F "tokens=2,3 delims=_=" %%a IN ('SET _d_^|find "=!PWS:~%%i,1!"') DO (
SET /A FF=!FF!+1
SET S!FF!=%%a
)
SET /A CF=%BASE%%%!FF!+1
CALL :OUT !CF!
SET/P=.<nul)
SET NCRY=%BASE%-%JG%
IF "%BOOT%" == "1" (
ECHO.>>"%~dpnx0"&&ECHO SET CRY=%NCRY%>>"%~dpnx0"
ECHO Password set successfully
GOTO END
) ELSE IF "%NCRY%" == "%BASE%-%CRY%" (
ECHO Verification successful&&GOTO NEXT
) ELSE (
ECHO Password error&&pause&&GOTO ENDSET)

GOTO END
:los
SET STR=%1
FOR /L %%i IN (0,1,128) DO if "!STR:~%%i,1!" == "" SET LOS=%%i&&GOTO :EOF
GOTO :EOF

:text
SET TEXT=!NDIC:~%1,1!
GOTO :EOF

:converse
SET /A NNPL=%NPL%-1
SET _tmp2=
SET _tmp1=!DIC:~%1,%2!
FOR /L %%i IN (%NNPL%,-1,0) DO SET _tmp2=!_tmp2!!_tmp1:~%%i,1!
SET NDIC=%_tmp2%!DIC:~%3,%4!
GOTO :EOF

:out
SET JG=!JG!!S%1!&&SET FF=
GOTO :EOF

:in
FOR /F "tokens=1,2 delims=-" %%i IN ("%CRY%") DO SET BASE=%%i&&SET CRY=%%j
CALL :LOS %CRY%
SET HCRY=%LOS%&&SET /A CHK=%LOS%%%3
IF NOT "%CHK%" == "0" ECHO Ciphertext damaged!&&GOTO END
GOTO :EOF

:endset
ENDLOCAL&cls
GOTO TOP

:next
ECHO OK..
GOTO END

:chk
::check label:calc matrix
for /l %%j in (0,1,62) do (
set /a sh=0
for /f "tokens=2 delims==" %%i in (1.txt) do (
if "!DIC:~%%j,1!" == "%%i" set /a sh=!sh!+1)
echo !DIC:~%%j,1! !sh! >>sh.txt)

:end
rem copyright:12232-530502-12000-046006035061035000002030034
PAUSE>nul
EXIT

:cry
::SET /A NDL=%DL%-1
::FOR /L %%i IN (0,1,%NDL%) DO ECHO %PWS%|find "!NDIC:~%%i,1!">nul&&SET BIY=!BIY!!NDIC:~%%i,1!
SET CRY=7304-552511527557551535939937543939547


[ Last edited by everest79 on 2006-12-31 at 05:06 AM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
redtek +7 2007-01-01 00:07
qzwqzw +8 2007-01-02 01:38
0401 +2 2007-01-03 08:30
Floor 2 Posted 2006-12-31 23:56 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Floor 3 Posted 2007-01-01 04:28 ·  中国 山东 济南 电信
社区乞丐
★★
此图片另存后死机
Credits -49
Posts 90
Joined 2006-12-02 13:00
19-year member
UID 72412
Gender Male
Status Offline
%RANDOM%
How is it possible to be reversed calculated???

Is it reverse enumeration????
我的网络笔记本.非联系本人请勿访问!http://w.vicp.net
Floor 4 Posted 2007-01-01 05:04 ·  中国 上海 教育网
初级用户
Credits 52
Posts 27
Joined 2006-10-06 00:44
19-year member
UID 64647
From ☆逍遥宫☆
Status Offline
Floor 5 Posted 2007-01-01 23:13 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Originally posted by tghksj at 2006-12-31 03:28 PM:
%RANDOM%
How is it possible to be reversed?

Is it reverse enumeration?????

When the password exists, the assigned %random% is replaced. Take a closer look at the IN section
Floor 6 Posted 2007-01-01 23:16 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Originally posted by Michale at 2006-12-31 04:04 PM:
Let's try~~


Come on, this password can indeed be calculated by a very simple method
Because of the calculation time issue, I deleted one part of the encryption, otherwise it would take a lot of time
Floor 7 Posted 2007-01-02 01:03 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
The password is

DOSlianmeng


The biggest loophole in this encryption is that the password length is the key to calculation. As long as you enumerate password lengths from 1 to 40, you can obtain the encryption matrix, then reverse look up the ciphertext, and divide it into segments of three characters each to get the password.
Floor 8 Posted 2007-01-02 01:47 ·  中国 江西 南昌 电信
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
The theoretical value is very high, but the practical value is not high.

Batch processing code is very easy to be modified, so it is not suitable for use as a password verification program.

It can indeed be used for text encryption, but the efficiency is worrying.

Moreover, the fact that this algorithm does not require a key for decryption also reduces security.

[ Last edited by qzwqzw on 2007-1-1 at 12:56 PM ]
Floor 9 Posted 2007-01-02 06:46 ·  中国 广东 广州 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Originally posted by qzwqzw at 2007-1-1 12:47 PM:
Theoretical value is very high, but practical value is not high

Batch processing code is easy to be modified, so it is not suitable for use as a password verification program

It can be used for text encryption, but the efficiency is worrying

And this calculation ...


These days I've been thinking about how this encryption can perform deep calculations without taking a long time. I post it just hoping everyone can have their own opinions. The envisioned application object is to encrypt the batch processing itself. Actually, it can't be regarded as real encryption because it's impossible to achieve the one-into-three integration of encryption standards. It's just setting an additional hurdle, increasing a bit of difficulty while adding more fun at the same time
Floor 10 Posted 2007-01-03 08:24 ·  中国 北京 联通
中级用户
★★
带走
Credits 435
Posts 88
Joined 2005-09-24 19:22
20-year member
UID 42793
Status Offline
Decryption P processing. Directly copied from the building block code of the original poster.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
SET A_X=9
SET B_Y=9
SET C_Z=9
SET DIC=abcdefghijklmnopqrstuvwxyz0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ
set error= Incorrect ciphertext format.
CALL :LOS %DIC%
SET DL=%LOS%
cls
:TOP

set NCRY=
set/p NCRY=Please enter ciphertext:
if not defined NCRY goto :top
for /f "tokens=1,2 delims=-" %%i in ("%NCRY%") do set BASE=%%i&set JG=%%j
if not defined BASE echo %error% & goto :top
if not defined JG echo %error% & goto :top
call :los %JG%
set/a NPL=%LOS%/3
set/a MPL=%LOS%%%3
if not %MPL%==0 echo %error% & goto :top

SET /A HPL=%DL%-%NPL%
CALL :CONVERSE -%NPL% %NPL% 0 -%NPL%

SET /A HDL=(%DL%-%DL%%%2)/2
SET ADL=!NDIC:~0,%HDL%!&&SET BDL=!NDIC:~%HDL%!&&SET NDIC=
FOR /L %%i IN (0,1,%HDL%) DO SET NDIC=!NDIC!!BDL:~%%i,1!!ADL:~%%i,1!

FOR /L %%z IN (0,1,%C_Z%) DO (
FOR /L %%y IN (0,1,%B_Y%) DO (
FOR /L %%x IN (0,1,%A_X%) DO (
SET /a WD=1%%x%%y%%z%%%DL%
CALL :TEXT !WD!
SET _d_%%x%%y%%z=!TEXT!)
)
SET/P=.<nul)

set /a enpl=nnpl*3

echo.Password is:
for /l %%i in (0,3,!enpl!) do (
for /f "tokens=2 delims==" %%j in ('set _d_^|find "!JG:~%%i,3!"') do (
set/p=%%j<nul
)
)
echo. & pause>nul
EXIT/B


:converse
SET /A NNPL=%NPL%-1
SET _tmp2=
SET _tmp1=!DIC:~%1,%2!
FOR /L %%i IN (%NNPL%,-1,0) DO SET _tmp2=!_tmp2!!_tmp1:~%%i,1!
SET NDIC=%_tmp2%!DIC:~%3,%4!
GOTO :EOF

:text
SET TEXT=!NDIC:~%1,1!
GOTO :EOF

:los
SET STR=%1
FOR /L %%i IN (0,1,128) DO if "!STR:~%%i,1!" == "" SET LOS=%%i&&GOTO :EOF
GOTO :EOF


[ Last edited by 0401 on 2007-1-3 at 08:27 AM ]
Floor 11 Posted 2007-01-03 08:32 ·  中国 北京 联通
中级用户
★★
带走
Credits 435
Posts 88
Joined 2005-09-24 19:22
20-year member
UID 42793
Status Offline
Originally posted by everest79 at 2007-1-1 23:16:

Come on, this password can indeed be calculated through a very simple method
Because of the calculation time issue, I deleted one part of the encryption, otherwise it would take a lot of time


Can the owner of the post post the complete version?
Forum Jump: