Last night someone posted a VB text encryption program
Using the Caesar cipher of adding 1 to each byte
Soon our moderator brother made a VBS version
Remembering that such simple text processing is more lightweight in assembly
But I was hot and sleepy yesterday, so I didn't code it
Today there was a moderate rain and it became much cooler
Although I was nervous and busy
But I still took the time to write it
To prevent forgetting it when the weather gets hot again tomorrow
-------------------------------------------------------
At first I planned to fully implement the +1/-1 cipher
Later considering to benefit our lazy people
I thought that XOR is simpler and more practical
+1 is too easy to guess, I once broke the encrypted code after +1 of a certain bat2exe program
The XOR algorithm is relatively harder to guess
And encryption/decryption can reuse a module
Originally wanted to support multi-bit keys
So that it is more practical
But unfortunately, whether +1 or +X or XOR X may get FF
And FF cannot be output to standard output
For the sake of simple code
Still used the scheme of XOR with E0~EF
So only the bytes from 10~1F may get FF
And this area are control characters
Rarely used in text files
------------------------------------------------------
Due to time constraints
No special circumstances
Not going to update it
Those interested can study it by themselves
[ Last edited by qzwqzw on 2007-6-5 at 12:09 PM ]
Using the Caesar cipher of adding 1 to each byte
Soon our moderator brother made a VBS version
Remembering that such simple text processing is more lightweight in assembly
But I was hot and sleepy yesterday, so I didn't code it
Today there was a moderate rain and it became much cooler
Although I was nervous and busy
But I still took the time to write it
To prevent forgetting it when the weather gets hot again tomorrow
-------------------------------------------------------
At first I planned to fully implement the +1/-1 cipher
Later considering to benefit our lazy people
I thought that XOR is simpler and more practical
+1 is too easy to guess, I once broke the encrypted code after +1 of a certain bat2exe program
The XOR algorithm is relatively harder to guess
And encryption/decryption can reuse a module
Originally wanted to support multi-bit keys
So that it is more practical
But unfortunately, whether +1 or +X or XOR X may get FF
And FF cannot be output to standard output
For the sake of simple code
Still used the scheme of XOR with E0~EF
So only the bytes from 10~1F may get FF
And this area are control characters
Rarely used in text files
------------------------------------------------------
Due to time constraints
No special circumstances
Not going to update it
Those interested can study it by themselves
@echo off & setlocal & chcp 437>nul & graftabl 936>nul
if "%~1"=="" (
echo.
echo.=Text File Encryption/Decryption Program :: qzwqzw :: 2007-06-05 :: Release 7
echo.
echo.=Principle: Dynamically generate an executable program using DEBUG script to XOR each byte of the input file
echo.
echo.=Features: Encryption and decryption are reciprocal, multi-file operation, single-digit key
echo.
set /p file=-Please enter the file name (supports wildcards, default is .\*.txt):
set /p pass=-Please enter the key (a hexadecimal number from 0~F, default is 0):
echo.
) else (
set "file=%~1"
set "pass=%~2"
)
if "%file%"=="" set file=*.txt
if "%pass%"=="" set pass=0
if not exist "%file%" echo !File not found: "%file%" && goto end
:: Generate and execute DEBUG script to generate conversion program
echo e 100 B4 06 B2 FF CD 21 74 08 34 E%pass% 88 C2 CD 21 EB F0 C3>_codec.scr
for %%s in (rcx 11 n_codec.com w q) do echo %%s>>_codec.scr
debug <_codec.scr | find "Error">nul && echo !Key error: "%pass%" && goto :end
:: Search for all matching files in the specified path for conversion
for %%f in ("%file%") do set "fPath=%%~dpf"
for /f "delims=" %%f in ('dir /a/b/od "%file%" 2^>nul') do (
(set "fIn=%fPath%%%f") && (set "fOut=%fPath%#%%f")
call :Codec
)
echo.
if exist _codec.* del _codec.*
if "%~0"=="%~f0" pause
goto :eof
:Codec
if exist "%fOut%" echo !File already exists: "%fOut%" && pause && goto :eof
echo +Converting "%fIn%" ...
if exist _codec.com _codec.com < "%fIn%" > "%fOut%"
if not exist "%fOut%" echo !Conversion failed, "%fOut%" not generated && pause
[ Last edited by qzwqzw on 2007-6-5 at 12:09 PM ]
Recent Ratings for This Post
( 3 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| youxi01 | +8 | 2007-05-30 15:58 |
| namejm | +10 | 2007-05-30 21:35 |
| electronixtar | +22 | 2007-12-06 14:44 |

DigestI