How to encrypt a text file using a package?

How can I encrypt contents in a text file using a package? and how can i decrypt it?

I tried to set each letter to a number, but I do not know how to split the string into each letter and do it.

I watched videos on youtube that help turn letters into numbers, but this was not done with the file.

this is the code that it provides in the video.

@echo off
setlocal enableDelayedExpansion

set /p code=Text:
set chars=0123456789abcdefghijklmnopqrstuvwxyz

for /L %%N in (10 1 36) do (

for /F %%C in ("!chars:~%%N,1!") do (

set "code=!code:%%C=%%N!"

)

)

echo !code! 
pause

Please help Thanks.

+4
source share
1 answer
@ECHO OFF
SET    abet=abcdefghijklmnopqrstuvwxyz!@#-/\ .0123456789
SET cipher1=8p#j4 9z\6w.ae@0u2r5o!xk-cf1b3g7hmqil/sntdvy
(
 FOR /f "delims=" %%a IN (q20794050.txt) DO (
  SET line=%%a
  CALL :encipher
 )
)>q20794050.txt.1
(
 FOR /f "delims=" %%a IN (q20794050.txt.1) DO (
  SET line=%%a
  CALL :decipher
 )
)>q20794050.txt.2
GOTO :EOF
:decipher
SET morf=%abet%
SET from=%cipher1%
GOTO trans
:encipher
SET from=%abet%
SET morf=%cipher1%
:trans
SET "enil="
:transl
SET $1=%from%
SET $2=%morf%
:transc
IF /i "%line:~0,1%"=="%$1:~0,1%" SET enil=%enil%%$2:~0,1%&GOTO transnc
SET $1=%$1:~1%
SET $2=%$2:~1%
IF DEFINED $2 GOTO transc
:: No translation - keep
SET enil=%enil%%line:~0,1%
:transnc
SET line=%line:~1%
IF DEFINED line GOTO transl
ECHO %enil%
GOTO :eof

Here you can do it with simple Chesar code (lookup).

abet (, ) , . , cipher1 - , abet cipher1.

, , abet, .

q20794050.txt:

The quick brown fox [jumps] {over} the lazy dog 9876543210.
9876543210 The quick brown fox !@#-/\ jumps over the lazy dog.f

q20794050.txt.1:

5z4huo\#whp2@xeh @kh[6oa0r]h{@!42}h5z4h.8c-hj@9hyvdtns/liqm
yvdtns/liqh5z4huo\#whp2@xeh @khf1b3g7h6oa0rh@!42h5z4h.8c-hj@9m 

( , Space)

q20794050.txt.2

: , % & | > <

, . /i IF, , abet cipher1 .

,

(for...do (...))>somefilename

somefilename, ECHO ed - ECHO .

+1

All Articles