Batch Text Encrypter

Introduction: Batch Text Encrypter

The batch file I am going to show you can encrypt text and the second file can decrypt it.the batch file isn't mine but I thought it was very interesting and anyone reading this might like it. The original code can be found here

Step 1: Encrypt Text

Copy this code into notepad and save it as Encryt.bat or anything else with the .bat file extension

@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
title Encrypt
color a
:mainmenu
set savefile=on
::set Encrypt=Nothing
(set CHAR[a]=UDFM45) & (set CHAR[b]=H21DGF) & (set CHAR[c]=FDH56D) & (set CHAR[d]=FGS546) & (set CHAR[e]=JUK4JH)
(set CHAR[f]=ERG54S) & (set CHAR[g]=T5H4FD) & (set CHAR[h]=RG641G) & (set CHAR[i]=RG4F4D) & (set CHAR[j]=RT56F6)
(set CHAR[k]=VCBC3B) & (set CHAR[l]=F8G9GF) & (set CHAR[m]=FD4CJS) & (set CHAR[n]=G423FG) & (set CHAR[o]=F45GC2)
(set CHAR[p]=TH5DF5) & (set CHAR[q]=CV4F6R) & (set CHAR[r]=XF64TS) & (set CHAR[s]=X78DGT) & (set CHAR[t]=TH74SJ)
(set CHAR[u]=BCX6DF) & (set CHAR[v]=FG65SD) & (set CHAR[w]=4KL45D) & (set CHAR[x]=GFH3F2) & (set CHAR[y]=GH56GF)
(set CHAR[z]=45T1FG) & (set CHAR[1]=D4G23D) & (set CHAR[2]=GB56FG) & (set CHAR[3]=SF45GF) & (set CHAR[4]=P4FF12)
(set CHAR[5]=F6DFG1) & (set CHAR[6]=56FG4G) & (set CHAR[7]=USGFDG) & (set CHAR[8]=FKHFDG) & (set CHAR[9]=IFGJH6)
(set CHAR[0]=87H8G7) & (set CHAR[@]=G25GHF) & (set CHAR[#]=45FGFH) & (set CHAR[$]=75FG45) & (set CHAR[*]=54GDH5)
(set CHAR[(]=45F465) & (set CHAR[.]=HG56FG) & (set CHAR[,]=DF56H4) & (set CHAR[-]=F5JHFH) & (set CHAR[ ]=SGF4HF)
(set CHAR[\]=45GH45) & (set CHAR[/]=56H45G)
echo Enter a string to encrypt:
set /p Encrypt=
cls
set Encrypt2=%Encrypt%
set "EncryptOut="
:encrypt2
set char=%Encrypt2:~0,1%
set Encrypt2=%Encrypt2:~1%
set EncryptOut=%EncryptOut%!CHAR[%char%]!
if not "%Encrypt2%"=="" goto encrypt2
echo Input string: %Encrypt%
echo.
echo Output string: %EncryptOut%
set string=%EncryptOut%
set temp_str=%string%
set str_len=0
:lengthloop
if defined temp_str (
set temp_str=%temp_str:~1%
set /A str_len += 1
goto lengthloop )
echo.
echo Output string is %str_len% characters long!
if "%savefile%"=="on" echo.%EncryptOut%>>%~d0%~p0encrypted.txt
echo.
start http://forum.imgburn.com/index.php?/topic/21566-batch-encryption-working/
pause
cls
goto mainmenu

Step 2: Decrypt Text

Save this batch file as Decrypt.bat or anything else with the .bat file extension

@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
title Decrypt
color a
:mainmenu
set savefile=on
::set Decrypt=Nothing
(set CHAR[UDFM45]=a) & (set CHAR[H21DGF]=b) & (set CHAR[FDH56D]=c) & (set CHAR[FGS546]=d) & (set CHAR[JUK4JH]=e)
(set CHAR[ERG54S]=f) & (set CHAR[T5H4FD]=g) & (set CHAR[RG641G]=h) & (set CHAR[RG4F4D]=i) & (set CHAR[RT56F6]=j)
(set CHAR[VCBC3B]=k) & (set CHAR[F8G9GF]=l) & (set CHAR[FD4CJS]=m) & (set CHAR[G423FG]=n) & (set CHAR[F45GC2]=o)
(set CHAR[TH5DF5]=p) & (set CHAR[CV4F6R]=q) & (set CHAR[XF64TS]=r) & (set CHAR[X78DGT]=s) & (set CHAR[TH74SJ]=t)
(set CHAR[BCX6DF]=u) & (set CHAR[FG65SD]=v) & (set CHAR[4KL45D]=w) & (set CHAR[GFH3F2]=x) & (set CHAR[GH56GF]=y)
(set CHAR[45T1FG]=z) & (set CHAR[D4G23D]=1) & (set CHAR[GB56FG]=2) & (set CHAR[SF45GF]=3) & (set CHAR[P4FF12]=4)
(set CHAR[F6DFG1]=5) & (set CHAR[56FG4G]=6) & (set CHAR[USGFDG]=7) & (set CHAR[FKHFDG]=8) & (set CHAR[IFGJH6]=9)
(set CHAR[87H8G7]=0) & (set CHAR[G25GHF]=@) & (set CHAR[45FGFH]=#) & (set CHAR[75FG45]=$) & (set CHAR[54GDH5]=*)
(set CHAR[45F465]=() & (set CHAR[HG56FG]=.) & (set CHAR[DF56H4]=,) & (set CHAR[F5JHFH]=-) & (set CHAR[SGF4HF]= )
(set CHAR[45GH45]=\) & (set CHAR[56H45G]=/)
echo Enter a string to decrypt:
set /p Decrypt=
cls
set Decrypt2=%Decrypt%
set "DecryptOut="
:decrypt2
set char=%Decrypt2:~0,6%
set Decrypt2=%Decrypt2:~6%
set DecryptOut=%DecryptOut%!CHAR[%char%]!
if not "%Decrypt2%"=="" goto decrypt2
echo Input string: %Decrypt%
echo.
echo Output string: %DecryptOut%
set string=%DecryptOut%
set temp_str=%string%
set str_len=0
:lengthloop
if defined temp_str (
set temp_str=%temp_str:~1%
set /A str_len += 1
goto lengthloop )
echo.
echo Output string is %str_len% characters long!
if "%savefile%"=="on" echo.%DecryptOut%>>%~d0%~p0decrypted.txt
echo.
start https://www.instructables.com/member/batchcc
pause
cls
goto mainmenu

Step 3: Other Batch Codes

Thank you for viewing my instructable please see my others

ore batch codes here

And

A full screen matrix batch code here

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest

    8 Discussions

    0
    None
    HeliT1

    11 months ago

    i tried a variation of @echo off

    setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

    title Decrypt

    color a

    :mainmenu

    set savefile=on

    ::set Decrypt=Nothing

    (set CHAR[a]=B) & (set CHAR[b]=a) & (set CHAR[c]=c) & (set CHAR[d]=d) & (set CHAR[e]=R)

    (set CHAR[f]=f) & (set CHAR[g]=g) & (set CHAR[h]=h) & (set CHAR[i]=O) & (set CHAR[j]=j)

    (set CHAR[k]=k) & (set CHAR[l]=l) & (set CHAR[m]=m) & (set CHAR[n]=u) & (set CHAR[o]=W)

    (set CHAR[p]=p) & (set CHAR[q]=q) & (set CHAR[r]=e) & (set CHAR[s]=s) & (set CHAR[t]=t)

    (set CHAR[u]=N) & (set CHAR[v]=v) & (set CHAR[w]=i) & (set CHAR[x]=x) & (set CHAR[y]=E)

    (set CHAR[z]=z) & (set CHAR[1]=1) & (set CHAR[2]=2) & (set CHAR[3]=3) & (set CHAR[4]=4)

    (set CHAR[5]=5) & (set CHAR[6]=6) & (set CHAR[7]=7) & (set CHAR[8]=8) & (set CHAR[9]=9)

    (set CHAR[0]=0) & (set CHAR[@]=@) & (set CHAR[#]=#) & (set CHAR[$]=$) & (set CHAR[*]=*)

    (set CHAR[(]=() & (set CHAR[.]=.) & (set CHAR[,]=,) & (set CHAR[-]=-) & (set CHAR[ ]= )

    (set CHAR[\]=\) & (set CHAR[/]=/)

    echo Enter a string to decrypt:

    set /p Decrypt=

    cls

    set Decrypt2=%Decrypt%

    set "DecryptOut="

    :decrypt2

    set char=%Decrypt2:~0,6%

    set Decrypt2=%Decrypt2:~6%

    set DecryptOut=%DecryptOut%!CHAR[%char%]!

    if not "%Decrypt2%"=="" goto decrypt2

    echo Input string: %Decrypt%

    echo.

    echo Output string: %DecryptOut%

    set string=%DecryptOut%

    set temp_str=%string%

    set str_len=0

    :lengthloop

    if defined temp_str (

    set temp_str=%temp_str:~1%

    set /A str_len += 1

    goto lengthloop )

    echo.

    echo Output string is %str_len% characters long!

    if "%savefile%"=="on" echo.%DecryptOut%>>%~d0%~p0decrypted.txt

    echo.

    pause

    cls

    goto mainmenu

    and i used the same key scheme in the encrypt one but this does not decrypt it although it encrypts it just fine the way i want it to any suggestions?

    This isnt secure "a" will always be UDFM45

    and "b" will always be H21DGF

    and "ab" will always be UDFM45H21DGF

    "ab" encypted will always be "a" encypted plus "b" encrypted

    P.S. this is a cipher not a encyption

    The only problem is that it doesn't know if a letter is using caps, so if you have a password with CAPS, when decrypting it will show up without CAPS

    Just wanted to state to Wolfbane221 that cipher is a form of encryption. So to say that is more of a cipher than encryption is like saying a shoe isn't a shoe because it has velcro straps.

    Hi, i have problems with running this some tips what should i do? I am running WIndows 7

    2 replies

    common things include did you copy to much ( the description) or did you miss a few lines.

    Another problem is saving it as .txt.bat instead of just .bat

    Cool Batch file. more of a cipher than encryption though :)