SHOW:
|
|
- or go back to the newest paste.
| 1 | @Echo OFF | |
| 2 | Title reto nº 10 solucion | |
| 3 | ||
| 4 | :: Caesar encryptor v0.1 | |
| 5 | :: By Elektro H@cker | |
| 6 | :: Foro.elhacker.net | |
| 7 | ||
| 8 | Setlocal enabledelayedexpansion | |
| 9 | - | Set "Charlist= abcdefghijklmnopqrstuwxyzzyxwutsrqponmlkjihgfedcbaABCDEFGHIJKLMNOPQRSTUWXYZZYXWUTSRQPONMLKJIHGFEDCBA01234567899876543210" |
| 9 | + | Set "Charlist= abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ01234567899876543210" |
| 10 | ||
| 11 | :Choose | |
| 12 | Set Word= | |
| 13 | Cls | |
| 14 | Echo+ | |
| 15 | Echo 1. Encriptar | MORE | |
| 16 | Echo 2. Desencriptar | MORE | |
| 17 | Set /P choice=^> | |
| 18 | If "%CHOICE%"=="1" (Goto :Encriptar) | |
| 19 | If "%CHOICE%"=="2" (Goto :Desencriptar) | |
| 20 | Goto :Choose | |
| 21 | ||
| 22 | ||
| 23 | :Encriptar | |
| 24 | ||
| 25 | :Menu | |
| 26 | Cls | |
| 27 | Echo Define el SHIFT para la encriptacion (Del 1 al 9) | MORE | |
| 28 | Set /P Shifted=^> | |
| 29 | Echo %Shifted% | FINDSTR "[1-9]" 1>NUL | |
| 30 | If %Errorlevel% EQU 1 (Goto :Menu) | |
| 31 | Echo+ | |
| 32 | Echo Ahora escribe algo para encriptar!! | MORE | |
| 33 | Set /P Input=^> | |
| 34 | Set /A Next_char_input=0 | |
| 35 | ||
| 36 | :Loop | |
| 37 | Set "Char=!Input:~%Next_char_input%,1!" | |
| 38 | If "%CHAR%" EQU " " ( | |
| 39 | Set "Word=!Word! " | |
| 40 | Set /A Next_char_input+=1 | |
| 41 | Goto :Loop | |
| 42 | ) | |
| 43 | If not defined char (goto :FIN) | |
| 44 | Set /A Next_Charlist+=1 | |
| 45 | If "%CHAR%" EQU "!Charlist:~%Next_Charlist%,1!" ( | |
| 46 | Set /A Next_Charlist+=%Shifted% | |
| 47 | call :Caesarize | |
| 48 | Set /A Next_Charlist=0 | |
| 49 | Set /A Next_char_input+=1 | |
| 50 | Goto :Loop | |
| 51 | ) ELSE (Goto :Loop) | |
| 52 | ||
| 53 | :Caesarize | |
| 54 | Set "Word=!Word!!Charlist:~%Next_Charlist%,1!" | |
| 55 | Goto :EOF | |
| 56 | ||
| 57 | :FIN | |
| 58 | Set "Word=!Word!+%SHIFTED%" | |
| 59 | Echo+ | |
| 60 | Echo Su texto encriptado: | MORE | |
| 61 | Echo:^> !WORD! | |
| 62 | Pause >Nul | |
| 63 | Goto :Choose | |
| 64 | ||
| 65 | :Desencriptar | |
| 66 | ||
| 67 | :Menu | |
| 68 | Cls | |
| 69 | Echo+ | |
| 70 | Echo Escribe la frase encriptada!! | MORE | |
| 71 | Set /P Input=^> | |
| 72 | Set /A Next_char_input=0 | |
| 73 | Set /A Shifted=%Input:~-1% | |
| 74 | Set "Input=%Input:~0,-2%" | |
| 75 | ||
| 76 | :Loop_decript | |
| 77 | Set "Char=!Input:~%Next_char_input%,1!" | |
| 78 | If "%CHAR%" EQU " " ( | |
| 79 | Set "Word=!Word! " | |
| 80 | Set /A Next_char_input+=1 | |
| 81 | Goto :Loop_decript | |
| 82 | ) | |
| 83 | If not defined char (goto :FIN) | |
| 84 | Set /A Next_Charlist+=1 | |
| 85 | If "%CHAR%" EQU "!Charlist:~%Next_Charlist%,1!" ( | |
| 86 | Set /A Next_Charlist-=%Shifted% | |
| 87 | call :Caesarize | |
| 88 | Set /A Next_Charlist=0 | |
| 89 | Set /A Next_char_input+=1 | |
| 90 | Goto :Loop_decript | |
| 91 | ) ELSE (Goto :Loop_decript) | |
| 92 | ||
| 93 | :FIN | |
| 94 | Set "Word=!Word!+%SHIFTED%" | |
| 95 | Echo+ | |
| 96 | Echo Su texto desencriptado: | MORE | |
| 97 | Echo:^> !WORD:~0,-2! | |
| 98 | Pause >Nul | |
| 99 | Goto :Choose |