Red de conocimientos turísticos - Conocimientos sobre calendario chino - Cifrar y descifrar cadenas usando programas por lotes o scripts

Cifrar y descifrar cadenas usando programas por lotes o scripts

Parece que llevo mucho tiempo escribiendo esto, pero fue muy problemático, así que lo dejé a la mitad. Cuando entré hoy, vi que aún no estaba resuelto, así que les mostraré el trabajo sin terminar.

Puede haber errores

@echo off

setlocal enableelayeexpansion

set /p shu=

set yushu=

set zhongshang=

setshang=

set beichushu=

set jieguo=

set base=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

:cal

establecer beichushu=%yushu%%shu:~0,1%

establecer shu=%shu:~1,100000%

establecer /a "shang=beichushu>>24"

establecer zhongshang=%%shu:~1,100000%

set zhongshang=%zhongshang%%shang%%

if "%zhongshang%"=="0" set zhongshang=

set /a "yushu=beichushu&0xFFFFFF"

si NO "%shu%" ==="" ir a cal

set tt=

set /a "a1=(yushu>>16)&0xFF"

set /a " a2=yushu&0xFF00"

set /a "a3=(yushu&0xFF)<& lt;16"

set /a "a=a1|a2|a3"

si NO "%zhongshang%"=="" ir a b1

si NO %a2% EQU 0 ir a b0

si %a1% EQU 0 ir a b2

ir a b1

:b0

si %a1% EQU 0 ir a b3

:b1

establecer /a " b =a&077"

establecer tmp=! base:~%b%,1!

establecer tt=%tmp%tt%

establecer /a "b= a&07700"

establecer /a " b>>=6"

establecer tmp=! base:~%b%,1!

set tt=%tmp%tt%

:b2

set /a "b=a&0770000"

establecer /a "b>>=12"

establecer tmp=!base:~%b%,1!

establecer tt=%tmp%tt%

:b3

set /a "b=a&077000000"

set /a "b>>=18"

set tmp=!base: ~%b%,1!

establecer tt=%tmp%%tt%

establecer jieguo=%jieguo%%tt%

establecer yushu=

establecer shu=%zhongshang%

establecer zhongshang=

si NO "%shu%"=="" ir a cal

echo %jieguo%

pausa

goto :eof

:eof

Estás intentando ver, ingresar números en una línea y luego quieres leer desde un archivo, deberías poder hacerlo tú mismo. El archivo descifrado aún carece de conversión de hexadecimal a decimal. No lo quiero, o lo inventaste después de leer mi idea

Si hay un error, discútelo conmigo

, discútelo conmigo

Otro descifrado base64

@echo off

setlocal enableelayedexpansion

set base= ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

for /l %% Yo en (0,1,25) hago (

set !base:~%%i,1!=%%i

)

:start

set /p str=

:loop

::Cada bucle toma 4 caracteres y los convierte en un número de 24 bits

establecer s1=%str:~0,1%

establecer s2=%str:~1,1%

establecer s3=%str:~2,1%

establecer s3=%str:~3,1%

if "%s2%"=="" establecer s2=A

si "%s3% "== "" establecer s3=A

if "%s4%"=="" establecer s4=A

establecer str=%str:~ 3,1000%

llamar ::getnum %s1% num1

llamar ::getnum %s2% num2

llamar ::getnum %s3% num3

call :: getnum %s4% num4

echo % num1% %num2% %num3%

set "num1=(num1<<18)||(num2<<12) ||( num3<<6)|||num4"

set "num1=(num1>>16)|||(num1 &0xff00)||((num1&0xff)<<16)"

:mientras

si NO "%str%"=="" ir al bucle

ir al inicio

pausar

ir a eof

:getnum

if "%1"=="+" (

establecer num=62

ir a regresar

)

if "%1"=="/" (

establecer num=63

ir a regresar

)

si %1 LSS es un número para ir

establezca num=!

si NO "%1" EQU "!base:~%num%,1!" set /a num=num+26

ir a regresar

:número

set /a num=s1+52

:return

set /a %2=num

:eof

div>