Help needed with building a text encryptor?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Help needed with building a text encryptor?

#1 Post by GameRunnerHD » 12 Nov 2014 20:00

I have a program that asks for a "Translation Code" Of three Letters or more.

It works like this:

"Enter your 1st letter"
set /p ALetter=">>"
Goto ACode%ALetter%

:Second
"Enter your 2nd letter"
set /p BLetter=">>"
Goto BCode%BLetter%

"Would your like to add another 2nd (middle)"
Set /p yn=">>"
If %yn%==y goto Second

"Enter your 3rd letter"
set /p CLetter=">>"
Goto CCode%CLetter%

----

The code works by running a specific command for the 1st Middle and Last Letters entered.
But instead of entering the "TranslationCode" one letter at a time i need a bit of code that will set each
letter in the "TranslationCode" to its own %var% and count how manny letters are in the code.

Like this:

If the TranslationCode=Lover then:
It would set L1=L L2=O L3=V L4=E L5=R
Then set Count=5(The code was 5 letters long)

Then run a counter like this(Or different if you find something better):
Set Count2=Count
Set Count3=1
If %count3%=1 (goto ACodeL1)
If %Count3% Gtr 1 (Goto BCodeL%count3%)
If %Count3%=Count2 (Goto BCodeL%count3%)
Set /a count3=%count3%+1

And i need a way to reverse the text like this:
Var1 = Lover
then have a command to reverse:
Set Var2=%var1%

Var2 now = revol



Thanks in advance!





BTW Heres the code i'm working on(A text encryptor):

"All code on this page it titled as a program called "Fireware". "Fireware" and the name of my software company "A Anonymous" are the works of "Austin Tyler Smith", anyone wishing to help code, and/or help with development WILL be credited if there info/code/help was directly useful. Also you have my FULL permission to use this code. Either in its current state, or by editing it to make your own. I do not require credit, but would greatly appreciate it."


Code: Select all

@echo off
set attempt=0
set error=NA
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Color f0
:MainMenu
Set EnDe=99
set menu=99
cls
TITLE Menu - Fireware Encrypt
Echo.
Echo                                    MainMenu
Echo                        Are you Encrypting or Decrypting?
Echo                                    ( E / D)
Echo.
Set /p menu=">>"
If %menu%==e goto Encrypt
If %menu%==E goto Encrypt
If %menu%==d goto Decrypt
If %menu%==D goto Decrypt
If %menu%==99 goto MainMenu
If Not %menu%==99 goto MainMenu
:Encrypt
Set WhatEnDe=Encrypting
Set Encrypt=99
set EnDe=0
TITLE Encryptor - Fireware Encrypt
cls
set Encrypt=
Echo.
Echo                       Please Enter Your Encryption Text
Echo                        (DO NOT USE SYMBOLES OR NUMBERS)
Set /p Encrypt=">>"
Set StartResult=%Encrypt%
If "%Encrypt%"=="99" goto Encrypt
If "%Encrypt%"=="" goto Encrypt
goto MainMenu2
:Decrypt
Set WhatEnDe=Decrypting
Set Decrypt=99
set EnDe=1
TITLE Decryptor - Fireware Encrypt
cls
set Decrypt=
Echo.
Echo                       Please Enter Your Decryption Code
Set /p Decrypt=">>"
Set StartResult=%Decrypt%
If "%Decrypt%"=="99" goto Decrypt
If "%Decrypt%"=="" goto Decrypt
Goto MainMenu2
:MainMenu2
TITLE Translation Code - Fireware Encrypt - %WhatEnDe%
cls
Echo.
Echo                            Your Translation Code Is
Echo                               Made Of Three Parts
Echo                            ENTER THEM IN THIS ORDER!
Echo                              ONE LETTER AT A TIME!
Echo.
Echo                   (First Letter)(Middle Letters)(Last Letter)
Echo                     (A LETTER)     (B LETTER)    (C LETTER)
Echo             Example:  (If Code= Lover / A=L, B=o v e, C=r)
Echo                         (If Code=Hack / A=H, B=a c, C=k)
Echo.
Echo                  [IF YOUR DECRYPTING ENTER YOUR CODE BACKWARDS!]
Echo             Example:   [If Code=lover / Then Enter: revol]
Echo                         [If Code=Hack / Then Enter: kcah]
Echo.
Pause
:MainCode1
TITLE Translation Code A - Fireware Encrypt - %WhatEnDe%
cls
Echo                             Enter Your "A" LETTER
Echo.
Set Where=ACode
Goto MenuSTART
:MainCode2
TITLE Translation Code B - Fireware Encrypt - %WhatEnDe%
cls
Echo                             Enter Your "B" LETTER
Echo               (You Will Be Asked To Add Another After Each Turn)
Echo.
Set Where=BCode
Goto MenuSTART
:MainCode3
TITLE Translation Code C - Fireware Encrypt - %WhatEnDe%
cls
Echo                             Enter Your "C" LETTER
Echo.
Set Where=CCode
Goto MenuSTART
:MenuSTART
set TranCode=99
set menu=99
Echo.
Echo                                    MainMenu
Echo                          Enter Your Translation Code
Echo                            (One Letter at a time!)
Echo.
Set /p TranCode=">>"
if %TranCode%==99 goto MenuSTART
if "%TranCode%"=="" goto MenuSTART
if "%where%"=="" (Set error=0001) & (goto Error)
goto Check
(Set error=0002) & (goto Error)
:Check
(set CHAR[a]=C) & (set CHAR[b]=A) & (set CHAR[c]=D) & (set CHAR[d]=A) & (set CHAR[e]=B) & (set CHAR[f]=A)
(set CHAR[g]=E) & (set CHAR[h]=B) & (set CHAR[i]=E) & (set CHAR[j]=E) & (set CHAR[k]=D) & (set CHAR[l]=A)
(set CHAR[m]=A) & (set CHAR[n]=C) & (set CHAR[o]=B) & (set CHAR[p]=E) & (set CHAR[q]=D) & (set CHAR[r]=E)
(set CHAR[s]=A) & (set CHAR[t]=E) & (set CHAR[u]=D) & (set CHAR[v]=B) & (set CHAR[w]=A) & (set CHAR[x]=B)
(set CHAR[y]=D) & (set CHAR[z]=B) & (set CHAR[ ]=) & (set CHAR[-]=-)
Set MainTCC=%TranCode%
set "MainTCcode="
:MAINTCConfirm
cls
Set char=%MainTCC:~0,1%
Set MainTCC=%MainTCC:~1%
Set MainTCcode=%MainTCcode%!CHAR[%char%]!
If not "%MainTCC%"=="" goto MAINTCConfirm
goto %where%%MainTCcode%%EnDe%
(Set error=0003) & (Goto Error)
:MainCode2Check
cls
set yn=99
Echo.
Echo                     Do You Want To Add Another "B" Letter?
Echo                       (Enter "Y" For Yes ^& "N" For No)
Echo.
Set /p yn=">>"
If "%yn%"=="y" goto MainCode2
If "%yn%"=="Y" goto MainCode2
If "%yn%"=="N" goto MainCode3
If "%yn%"=="n" goto MainCode3
If "%yn%"=="99" goto MainCode2Check
If not "%yn%"=="99" goto MainCode2Check
(Set error=0004) & (Goto Error)
:ACodeA0
(set CHAR[a]=12-) & (set CHAR[b]=76-) & (set CHAR[c]=64-) & (set CHAR[d]=24-) & (set CHAR[e]=14-) & (set CHAR[f]=96-)
(set CHAR[g]=98-) & (set CHAR[h]=68-) & (set CHAR[i]=56-) & (set CHAR[j]=42-) & (set CHAR[k]=52-) & (set CHAR[l]=86-)
(set CHAR[m]=84-) & (set CHAR[n]=88-) & (set CHAR[o]=48-) & (set CHAR[p]=74-) & (set CHAR[q]=78-) & (set CHAR[r]=82-)
(set CHAR[s]=36-) & (set CHAR[t]=32-) & (set CHAR[u]=34-) & (set CHAR[v]=38-) & (set CHAR[w]=58-) & (set CHAR[x]=54-)
(set CHAR[y]=66-) & (set CHAR[z]=75-) & (set CHAR[ ]=72-) & (set CHAR[-]=-)
Set ACodeA0C=%Encrypt%
set "ACodeA0code="
:ACodeA0Confirm
cls
Set char=%ACodeA0C:~0,1%
Set ACodeA0C=%ACodeA0C:~1%
Set ACodeA0code=%ACodeA0code%!CHAR[%char%]!
If not "%ACodeA0C%"=="" goto ACodeA0Confirm
Set CodeData0=%ACodeA0code%
Goto MainCode2
:ACodeB0
(set CHAR[a]=85-) & (set CHAR[b]=67-) & (set CHAR[c]=01-) & (set CHAR[d]=83-) & (set CHAR[e]=94-) & (set CHAR[f]=07-)
(set CHAR[g]=05-) & (set CHAR[h]=98-) & (set CHAR[i]=04-) & (set CHAR[j]=84-) & (set CHAR[k]=50-) & (set CHAR[l]=91-)
(set CHAR[m]=23-) & (set CHAR[n]=56-) & (set CHAR[o]=63-) & (set CHAR[p]=77-) & (set CHAR[q]=49-) & (set CHAR[r]=33-)
(set CHAR[s]=86-) & (set CHAR[t]=92-) & (set CHAR[u]=95-) & (set CHAR[v]=39-) & (set CHAR[w]=03-) & (set CHAR[x]=62-)
(set CHAR[y]=48-) & (set CHAR[z]=10-) & (set CHAR[ ]=60-) & (set CHAR[-]=-)
Set ACodeB0C=%Encrypt%
set "ACodeB0code="
:ACodeB0Confirm
cls
Set char=%ACodeB0C:~0,1%
Set ACodeB0C=%ACodeB0C:~1%
Set ACodeB0code=%ACodeB0code%!CHAR[%char%]!
If not "%ACodeB0C%"=="" goto ACodeB0Confirm
Set CodeData0=%ACodeB0code%
Goto MainCode2
:ACodeC0
(set CHAR[a]=00-) & (set CHAR[b]=05-) & (set CHAR[c]=10-) & (set CHAR[d]=15-) & (set CHAR[e]=19-) & (set CHAR[f]=23-)
(set CHAR[g]=01-) & (set CHAR[h]=06-) & (set CHAR[i]=11-) & (set CHAR[j]=16-) & (set CHAR[k]=20-) & (set CHAR[l]=24-)
(set CHAR[m]=02-) & (set CHAR[n]=07-) & (set CHAR[o]=12-) & (set CHAR[p]=17-) & (set CHAR[q]=21-) & (set CHAR[r]=25-)
(set CHAR[s]=03-) & (set CHAR[t]=08-) & (set CHAR[u]=13-) & (set CHAR[v]=18-) & (set CHAR[w]=22-) & (set CHAR[x]=26-)
(set CHAR[y]=04-) & (set CHAR[z]=09-) & (set CHAR[ ]=14-) & (set CHAR[-]=-)
Set ACodeC0C=%Encrypt%
set "ACodeC0code="
:ACodeC0Confirm
cls
Set char=%ACodeC0C:~0,1%
Set ACodeC0C=%ACodeC0C:~1%
Set ACodeC0code=%ACodeC0code%!CHAR[%char%]!
If not "%ACodeC0C%"=="" goto ACodeC0Confirm
Set CodeData0=%ACodeC0code%
Goto MainCode2
:ACodeD0
(set CHAR[a]=26-) & (set CHAR[b]=25-) & (set CHAR[c]=24-) & (set CHAR[d]=23-) & (set CHAR[e]=22-) & (set CHAR[f]=21-)
(set CHAR[g]=20-) & (set CHAR[h]=19-) & (set CHAR[i]=18-) & (set CHAR[j]=17-) & (set CHAR[k]=16-) & (set CHAR[l]=15-)
(set CHAR[m]=14-) & (set CHAR[n]=13-) & (set CHAR[o]=12-) & (set CHAR[p]=11-) & (set CHAR[q]=10-) & (set CHAR[r]=09-)
(set CHAR[s]=08-) & (set CHAR[t]=07-) & (set CHAR[u]=06-) & (set CHAR[v]=05-) & (set CHAR[w]=04-) & (set CHAR[x]=03-)
(set CHAR[y]=02-) & (set CHAR[z]=01-) & (set CHAR[ ]=00-) & (set CHAR[-]=-)
Set ACodeD0C=%Encrypt%
set "ACodeD0code="
:ACodeD0Confirm
cls
Set char=%ACodeD0C:~0,1%
Set ACodeD0C=%ACodeD0C:~1%
Set ACodeD0code=%ACodeD0code%!CHAR[%char%]!
If not "%ACodeD0C%"=="" goto ACodeD0Confirm
Set CodeData0=%ACodeD0code%
Goto MainCode2
:ACodeE0
(set CHAR[a]=06-) & (set CHAR[b]=12-) & (set CHAR[c]=45-) & (set CHAR[d]=67-) & (set CHAR[e]=36-) & (set CHAR[f]=49-)
(set CHAR[g]=10-) & (set CHAR[h]=13-) & (set CHAR[i]=43-) & (set CHAR[j]=82-) & (set CHAR[k]=65-) & (set CHAR[l]=30-)
(set CHAR[m]=01-) & (set CHAR[n]=96-) & (set CHAR[o]=95-) & (set CHAR[p]=76-) & (set CHAR[q]=40-) & (set CHAR[r]=31-)
(set CHAR[s]=03-) & (set CHAR[t]=09-) & (set CHAR[u]=92-) & (set CHAR[v]=37-) & (set CHAR[w]=99-) & (set CHAR[x]=02-)
(set CHAR[y]=19-) & (set CHAR[z]=27-) & (set CHAR[ ]=41-) & (set CHAR[-]=-)
Set ACodeE0C=%Encrypt%
set "ACodeE0code="
:ACodeE0Confirm
cls
Set char=%ACodeE0C:~0,1%
Set ACodeE0C=%ACodeE0C:~1%
Set ACodeE0code=%ACodeE0code%!CHAR[%char%]!
If not "%ACodeE0C%"=="" goto ACodeE0Confirm
Set CodeData0=%ACodeE0code%
Goto MainCode2
:BCodeA0
(set CHAR[1]=2) & (set CHAR[2]=3) & (set CHAR[3]=4) & (set CHAR[4]=5) & (set CHAR[5]=6) & (set CHAR[6]=7)
(set CHAR[7]=8) & (set CHAR[8]=9) & (set CHAR[9]=0) & (set CHAR[0]=1) & (set CHAR[-]=-)
Set BCodeA0C=%CodeData0%
set "BCodeA0code="
:BCodeA0Confirm
cls
Set char=%BCodeA0C:~0,1%
Set BCodeA0C=%BCodeA0C:~1%
Set BCodeA0code=%BCodeA0code%!CHAR[%char%]!
If not "%BCodeA0C%"=="" goto BCodeA0Confirm
Set CodeData0=%BCodeA0code%
Goto MainCode2Check
:BCodeB0
(set CHAR[1]=6) & (set CHAR[2]=8) & (set CHAR[3]=1) & (set CHAR[4]=3) & (set CHAR[5]=0) & (set CHAR[6]=4)
(set CHAR[7]=7) & (set CHAR[8]=2) & (set CHAR[9]=5) & (set CHAR[0]=9) & (set CHAR[-]=-)
Set BCodeB0C=%CodeData0%
set "BCodeB0code="
:BCodeB0Confirm
cls
Set char=%BCodeB0C:~0,1%
Set BCodeB0C=%BCodeB0C:~1%
Set BCodeB0code=%BCodeB0code%!CHAR[%char%]!
If not "%BCodeB0C%"=="" goto BCodeB0Confirm
Set CodeData0=%BCodeB0code%
Goto MainCode2Check
:BCodeC0
(set CHAR[1]=5) & (set CHAR[2]=2) & (set CHAR[3]=0) & (set CHAR[4]=8) & (set CHAR[5]=7) & (set CHAR[6]=9)
(set CHAR[7]=4) & (set CHAR[8]=6) & (set CHAR[9]=3) & (set CHAR[0]=1) & (set CHAR[-]=-)
Set BCodeC0C=%CodeData0%
set "BCodeC0code="
:BCodeC0Confirm
cls
Set char=%BCodeC0C:~0,1%
Set BCodeC0C=%BCodeC0C:~1%
Set BCodeC0code=%BCodeC0code%!CHAR[%char%]!
If not "%BCodeC0C%"=="" goto BCodeC0Confirm
Set CodeData0=%BCodeC0code%
Goto MainCode2Check
:BCodeD0
(set CHAR[1]=7) & (set CHAR[2]=4) & (set CHAR[3]=6) & (set CHAR[4]=1) & (set CHAR[5]=3) & (set CHAR[6]=8)
(set CHAR[7]=2) & (set CHAR[8]=0) & (set CHAR[9]=5) & (set CHAR[0]=9) & (set CHAR[-]=-)
Set BCodeD0C=%CodeData0%
set "BCodeD0code="
:BCodeD0Confirm
cls
Set char=%BCodeD0C:~0,1%
Set BCodeD0C=%BCodeD0C:~1%
Set BCodeD0code=%BCodeD0code%!CHAR[%char%]!
If not "%BCodeD0C%"=="" goto BCodeD0Confirm
Set CodeData0=%BCodeD0code%
Goto MainCode2Check
:BCodeE0
(set CHAR[1]=4) & (set CHAR[2]=5) & (set CHAR[3]=1) & (set CHAR[4]=0) & (set CHAR[5]=3) & (set CHAR[6]=6)
(set CHAR[7]=8) & (set CHAR[8]=9) & (set CHAR[9]=7) & (set CHAR[0]=2) & (set CHAR[-]=-)
Set BCodeE0C=%CodeData0%
set "BCodeE0code="
:BCodeE0Confirm
cls
Set char=%BCodeE0C:~0,1%
Set BCodeE0C=%BCodeE0C:~1%
Set BCodeE0code=%BCodeE0code%!CHAR[%char%]!
If not "%BCodeE0C%"=="" goto BCodeE0Confirm
Set CodeData0=%BCodeE0code%
Goto MainCode2Check
:CCodeA0
(set CHAR[1]=H) & (set CHAR[2]=6) & (set CHAR[3]=9) & (set CHAR[4]=U) & (set CHAR[5]=A) & (set CHAR[6]=0)
(set CHAR[7]=3) & (set CHAR[8]=1) & (set CHAR[9]=L) & (set CHAR[0]=Z) & (set CHAR[-]=-)
Set CCodeA0C=%CodeData0%
set "CCodeA0code="
:CCodeA0Confirm
cls
Set char=%CCodeA0C:~0,1%
Set CCodeA0C=%CCodeA0C:~1%
Set CCodeA0code=%CCodeA0code%!CHAR[%char%]!
If not "%CCodeA0C%"=="" goto CCodeA0Confirm
Set FinishResult=%CCodeA0code%
Goto End
:CCodeB0
(set CHAR[1]=H) & (set CHAR[2]=S) & (set CHAR[3]=K) & (set CHAR[4]=3) & (set CHAR[5]=G) & (set CHAR[6]=E)
(set CHAR[7]=9) & (set CHAR[8]=1) & (set CHAR[9]=5) & (set CHAR[0]=N) & (set CHAR[-]=-)
Set CCodeB0C=%CodeData0%
set "CCodeB0code="
:CCodeB0Confirm
cls
Set char=%CCodeB0C:~0,1%
Set CCodeB0C=%CCodeB0C:~1%
Set CCodeB0code=%CCodeB0code%!CHAR[%char%]!
If not "%CCodeB0C%"=="" goto CCodeB0Confirm
Set FinishResult=%CCodeB0code%
Goto End
:CCodeC0
(set CHAR[1]=I) & (set CHAR[2]=H) & (set CHAR[3]=E) & (set CHAR[4]=4) & (set CHAR[5]=P) & (set CHAR[6]=7)
(set CHAR[7]=6) & (set CHAR[8]=5) & (set CHAR[9]=U) & (set CHAR[0]=Y) & (set CHAR[-]=-)
Set CCodeC0C=%CodeData0%
set "CCodeC0code="
:CCodeC0Confirm
cls
Set char=%CCodeC0C:~0,1%
Set CCodeC0C=%CCodeC0C:~1%
Set CCodeC0code=%CCodeC0code%!CHAR[%char%]!
If not "%CCodeC0C%"=="" goto CCodeC0Confirm
Set FinishResult=%CCodeC0code%
Goto End
:CCodeD0
(set CHAR[1]=K) & (set CHAR[2]=8) & (set CHAR[3]=Z) & (set CHAR[4]=3) & (set CHAR[5]=G) & (set CHAR[6]=0)
(set CHAR[7]=9) & (set CHAR[8]=O) & (set CHAR[9]=L) & (set CHAR[0]=M) & (set CHAR[-]=-)
Set CCodeD0C=%CodeData0%
set "CCodeD0code="
:CCodeD0Confirm
cls
Set char=%CCodeD0C:~0,1%
Set CCodeD0C=%CCodeD0C:~1%
Set CCodeD0code=%CCodeD0code%!CHAR[%char%]!
If not "%CCodeD0C%"=="" goto CCodeD0Confirm
Set FinishResult=%CCodeD0code%
Goto End
:CCodeE0
(set CHAR[1]=Q) & (set CHAR[2]=W) & (set CHAR[3]=R) & (set CHAR[4]=8) & (set CHAR[5]=T) & (set CHAR[6]=D)
(set CHAR[7]=9) & (set CHAR[8]=2) & (set CHAR[9]=0) & (set CHAR[0]=I) & (set CHAR[-]=-)
Set CCodeE0C=%CodeData0%
set "CCodeE0code="
:CCodeE0Confirm
cls
Set char=%CCodeE0C:~0,1%
Set CCodeE0C=%CCodeE0C:~1%
Set CCodeE0code=%CCodeE0code%!CHAR[%char%]!
If not "%CCodeE0C%"=="" goto CCodeE0Confirm
Set FinishResult=%CCodeE0code%
Goto End
:ACodeA1
(set CHAR[H]=1) & (set CHAR[6]=2) & (set CHAR[9]=3) & (set CHAR[U]=4) & (set CHAR[A]=5) & (set CHAR[0]=6)
(set CHAR[3]=7) & (set CHAR[1]=8) & (set CHAR[L]=9) & (set CHAR[Z]=0) & (set CHAR[-]=-)
Set ACodeA1C=%Decrypt%
set "ACodeA1code="
:ACodeA1Confirm
cls
Set char=%ACodeA1C:~0,1%
Set ACodeA1C=%ACodeA1C:~1%
Set ACodeA1code=%ACodeA1code%!CHAR[%char%]!
If not "%ACodeA1C%"=="" goto ACodeA1Confirm
Set CodeData1=%ACodeA1code%
Goto MainCode2
:ACodeB1
(set CHAR[H]=1) & (set CHAR[S]=2) & (set CHAR[K]=3) & (set CHAR[3]=4) & (set CHAR[G]=5) & (set CHAR[E]=6)
(set CHAR[9]=7) & (set CHAR[1]=8) & (set CHAR[5]=9) & (set CHAR[N]=0) & (set CHAR[-]=-)
Set ACodeB1C=%Decrypt%
set "ACodeB1code="
:ACodeB1Confirm
cls
Set char=%ACodeB1C:~0,1%
Set ACodeB1C=%ACodeB1C:~1%
Set ACodeB1code=%ACodeB1code%!CHAR[%char%]!
If not "%ACodeB1C%"=="" goto ACodeB1Confirm
Set CodeData1=%ACodeB1code%
Goto MainCode2
:ACodeC1
(set CHAR[I]=1) & (set CHAR[H]=2) & (set CHAR[E]=3) & (set CHAR[4]=4) & (set CHAR[P]=5) & (set CHAR[7]=6)
(set CHAR[6]=7) & (set CHAR[5]=8) & (set CHAR[U]=9) & (set CHAR[Y]=0) & (set CHAR[-]=-)
Set ACodeC1C=%Decrypt%
set "ACodeC1code="
:ACodeC1Confirm
cls
Set char=%ACodeC1C:~0,1%
Set ACodeC1C=%ACodeC1C:~1%
Set ACodeC1code=%ACodeC1code%!CHAR[%char%]!
If not "%ACodeC1C%"=="" goto ACodeC1Confirm
Set CodeData1=%ACodeC1code%
Goto MainCode2
:ACodeD1
(set CHAR[K]=1) & (set CHAR[8]=2) & (set CHAR[Z]=3) & (set CHAR[3]=4) & (set CHAR[G]=5) & (set CHAR[0]=6)
(set CHAR[9]=7) & (set CHAR[O]=8) & (set CHAR[L]=9) & (set CHAR[M]=0) & (set CHAR[-]=-)
Set ACodeD1C=%Decrypt%
set "ACodeD1code="
:ACodeD1Confirm
cls
Set char=%ACodeD1C:~0,1%
Set ACodeD1C=%ACodeD1C:~1%
Set ACodeD1code=%ACodeD1code%!CHAR[%char%]!
If not "%ACodeD1C%"=="" goto ACodeD1Confirm
Set CodeData1=%ACodeD1code%
Goto MainCode2
:ACodeE1
(set CHAR[Q]=1) & (set CHAR[W]=2) & (set CHAR[R]=3) & (set CHAR[8]=4) & (set CHAR[T]=5) & (set CHAR[D]=6)
(set CHAR[9]=7) & (set CHAR[2]=8) & (set CHAR[0]=9) & (set CHAR[I]=0) & (set CHAR[-]=-)
Set ACodeE1C=%Decrypt%
set "ACodeE1code="
:ACodeE1Confirm
cls
Set char=%ACodeE1C:~0,1%
Set ACodeE1C=%ACodeE1C:~1%
Set ACodeE1code=%ACodeE1code%!CHAR[%char%]!
If not "%ACodeE1C%"=="" goto ACodeE1Confirm
Set CodeData1=%ACodeE1code%
Goto MainCode2
:BCodeA1
(set CHAR[2]=1) & (set CHAR[3]=2) & (set CHAR[4]=3) & (set CHAR[5]=4) & (set CHAR[6]=5) & (set CHAR[7]=6)
(set CHAR[8]=7) & (set CHAR[9]=8) & (set CHAR[0]=9) & (set CHAR[1]=0) & (set CHAR[-]=-)
Set BCodeA1C=%CodeData1%
set "BCodeA1code="
:BCodeA1Confirm
cls
Set char=%BCodeA1C:~0,1%
Set BCodeA1C=%BCodeA1C:~1%
Set BCodeA1code=%BCodeA1code%!CHAR[%char%]!
If not "%BCodeA1C%"=="" goto BCodeA1Confirm
Set CodeData1=%BCodeA1code%
Goto MainCode2Check
:BCodeB1
(set CHAR[6]=1) & (set CHAR[8]=2) & (set CHAR[1]=3) & (set CHAR[3]=4) & (set CHAR[0]=5) & (set CHAR[4]=6)
(set CHAR[7]=7) & (set CHAR[2]=8) & (set CHAR[5]=9) & (set CHAR[9]=0) & (set CHAR[-]=-)
Set BCodeB1C=%CodeData1%
set "BCodeB1code="
:BCodeB1Confirm
cls
Set char=%BCodeB1C:~0,1%
Set BCodeB1C=%BCodeB1C:~1%
Set BCodeB1code=%BCodeB1code%!CHAR[%char%]!
If not "%BCodeB1C%"=="" goto BCodeB1Confirm
Set CodeData1=%BCodeB1code%
Goto MainCode2Check
:BCodeC1
(set CHAR[5]=1) & (set CHAR[2]=2) & (set CHAR[0]=3) & (set CHAR[8]=4) & (set CHAR[7]=5) & (set CHAR[9]=6)
(set CHAR[4]=7) & (set CHAR[6]=8) & (set CHAR[3]=9) & (set CHAR[1]=0) & (set CHAR[-]=-)
Set BCodeC1C=%CodeData1%
set "BCodeC1code="
:BCodeC1Confirm
cls
Set char=%BCodeC1C:~0,1%
Set BCodeC1C=%BCodeC1C:~1%
Set BCodeC1code=%BCodeC1code%!CHAR[%char%]!
If not "%BCodeC1C%"=="" goto BCodeC1Confirm
Set CodeData1=%BCodeC1code%
Goto MainCode2Check
:BCodeD1
(set CHAR[7]=1) & (set CHAR[4]=2) & (set CHAR[6]=3) & (set CHAR[1]=4) & (set CHAR[3]=5) & (set CHAR[8]=6)
(set CHAR[2]=7) & (set CHAR[0]=8) & (set CHAR[5]=9) & (set CHAR[9]=0) & (set CHAR[-]=-)
Set BCodeD1C=%CodeData1%
set "BCodeD1code="
:BCodeD1Confirm
cls
Set char=%BCodeD1C:~0,1%
Set BCodeD1C=%BCodeD1C:~1%
Set BCodeD1code=%BCodeD1code%!CHAR[%char%]!
If not "%BCodeD1C%"=="" goto BCodeD1Confirm
Set CodeData1=%BCodeD1code%
Goto MainCode2Check
:BCodeE1
(set CHAR[4]=1) & (set CHAR[5]=2) & (set CHAR[1]=3) & (set CHAR[0]=4) & (set CHAR[3]=5) & (set CHAR[6]=6)
(set CHAR[8]=7) & (set CHAR[9]=8) & (set CHAR[7]=9) & (set CHAR[2]=0) & (set CHAR[-]=-)
Set BCodeE1C=%CodeData1%
set "BCodeE1code="
:BCodeE1Confirm
cls
Set char=%BCodeE1C:~0,1%
Set BCodeE1C=%BCodeE1C:~1%
Set BCodeE1code=%BCodeE1code%!CHAR[%char%]!
If not "%BCodeE1C%"=="" goto BCodeE1Confirm
Set CodeData1=%BCodeE1code%
Goto MainCode2Check
:CCodeA1
(set CHAR[12-]=a) & (set CHAR[76-]=b) & (set CHAR[64-]=c) & (set CHAR[24-]=d) & (set CHAR[14-]=e) & (set CHAR[96-]=f)
(set CHAR[98-]=g) & (set CHAR[68-]=h) & (set CHAR[56-]=i) & (set CHAR[42-]=j) & (set CHAR[52-]=k) & (set CHAR[86-]=l)
(set CHAR[84-]=m) & (set CHAR[88-]=n) & (set CHAR[48-]=o) & (set CHAR[74-]=p) & (set CHAR[78-]=q) & (set CHAR[82-]=r)
(set CHAR[36-]=s) & (set CHAR[32-]=t) & (set CHAR[34-]=u) & (set CHAR[38-]=v) & (set CHAR[58-]=w) & (set CHAR[54-]=x)
(set CHAR[66-]=y) & (set CHAR[75-]=z) & (set CHAR[72-]= ) & (set CHAR[-]=)
Set CCodeA1C=%CodeData1%
set "CCodeA1code="
:CCodeA1Confirm
cls
Set char=%CCodeA1C:~0,3%
Set CCodeA1C=%CCodeA1C:~1%
Set CCodeA1code=%CCodeA1code%!CHAR[%char%]!
If not "%CCodeA1C%"=="" goto CCodeA1Confirm
Set FinishResult=%CCodeA1code%
Goto End
:CCodeB1
(set CHAR[85-]=a) & (set CHAR[67-]=b) & (set CHAR[01-]=c) & (set CHAR[83-]=d) & (set CHAR[94-]=e) & (set CHAR[07-]=f)
(set CHAR[05-]=g) & (set CHAR[98-]=h) & (set CHAR[04-]=i) & (set CHAR[84-]=j) & (set CHAR[50-]=k) & (set CHAR[91-]=l)
(set CHAR[23-]=m) & (set CHAR[56-]=n) & (set CHAR[63-]=o) & (set CHAR[77-]=p) & (set CHAR[49-]=q) & (set CHAR[33-]=r)
(set CHAR[86-]=s) & (set CHAR[92-]=t) & (set CHAR[95-]=u) & (set CHAR[39-]=v) & (set CHAR[03-]=w) & (set CHAR[62-]=x)
(set CHAR[48-]=y) & (set CHAR[10-]=z) & (set CHAR[60-]= ) & (set CHAR[-]=)
Set CCodeB1C=%CodeData1%
set "CCodeB1code="
:CCodeB1Confirm
cls
Set char=%CCodeB1C:~0,3%
Set CCodeB1C=%CCodeB1C:~1%
Set CCodeB1code=%CCodeB1code%!CHAR[%char%]!
If not "%CCodeB1C%"=="" goto CCodeB1Confirm
Set FinishResult=%CCodeB1code%
Goto End
:CCodeC1
(set CHAR[00-]=a) & (set CHAR[05-]=b) & (set CHAR[10-]=c) & (set CHAR[15-]=d) & (set CHAR[19-]=e) & (set CHAR[23-]=f)
(set CHAR[01-]=g) & (set CHAR[06-]=h) & (set CHAR[11-]=i) & (set CHAR[16-]=j) & (set CHAR[20-]=k) & (set CHAR[24-]=l)
(set CHAR[02-]=m) & (set CHAR[07-]=n) & (set CHAR[12-]=o) & (set CHAR[17-]=p) & (set CHAR[21-]=q) & (set CHAR[25-]=r)
(set CHAR[03-]=s) & (set CHAR[08-]=t) & (set CHAR[13-]=u) & (set CHAR[18-]=v) & (set CHAR[22-]=w) & (set CHAR[26-]=x)
(set CHAR[04-]=y) & (set CHAR[09-]=z) & (set CHAR[14-]= ) & (set CHAR[-]=)
Set CCodeC1C=%CodeData1%
set "CCodeC1code="
:CCodeC1Confirm
cls
Set char=%CCodeC1C:~0,3%
Set CCodeC1C=%CCodeC1C:~1%
Set CCodeC1code=%CCodeC1code%!CHAR[%char%]!
If not "%CCodeC1C%"=="" goto CCodeC1Confirm
Set FinishResult=%CCodeC1code%
Goto End
:CCodeD1
(set CHAR[26-]=a) & (set CHAR[25-]=b) & (set CHAR[24-]=c) & (set CHAR[23-]=d) & (set CHAR[22-]=e) & (set CHAR[21-]=f)
(set CHAR[20-]=g) & (set CHAR[19-]=h) & (set CHAR[18-]=i) & (set CHAR[17-]=j) & (set CHAR[16-]=k) & (set CHAR[15-]=l)
(set CHAR[14-]=m) & (set CHAR[13-]=n) & (set CHAR[12-]=o) & (set CHAR[11-]=p) & (set CHAR[10-]=q) & (set CHAR[09-]=r)
(set CHAR[08-]=s) & (set CHAR[07-]=t) & (set CHAR[06-]=u) & (set CHAR[05-]=v) & (set CHAR[04-]=w) & (set CHAR[03-]=x)
(set CHAR[02-]=y) & (set CHAR[01-]=z) & (set CHAR[00-]= ) & (set CHAR[-]=)
Set CCodeD1C=%CodeData1%
set "CCodeD1code="
:CCodeD1Confirm
cls
Set char=%CCodeD1C:~0,3%
Set CCodeD1C=%CCodeD1C:~1%
Set CCodeD1code=%CCodeD1code%!CHAR[%char%]!
If not "%CCodeD1C%"=="" goto CCodeD1Confirm
Set FinishResult=%CCodeD1code%
Goto End
:CCodeE1
(set CHAR[06-]=a) & (set CHAR[12-]=b) & (set CHAR[45-]=c) & (set CHAR[67-]=d) & (set CHAR[36-]=e) & (set CHAR[49-]=f)
(set CHAR[10-]=g) & (set CHAR[13-]=h) & (set CHAR[43-]=i) & (set CHAR[82-]=j) & (set CHAR[65-]=k) & (set CHAR[30-]=l)
(set CHAR[01-]=m) & (set CHAR[96-]=n) & (set CHAR[95-]=o) & (set CHAR[76-]=p) & (set CHAR[40-]=q) & (set CHAR[31-]=r)
(set CHAR[03-]=s) & (set CHAR[09-]=t) & (set CHAR[92-]=u) & (set CHAR[37-]=v) & (set CHAR[99-]=w) & (set CHAR[02-]=x)
(set CHAR[19-]=y) & (set CHAR[27-]=z) & (set CHAR[41-]= ) & (set CHAR[-]=)
Set CCodeE1C=%CodeData1%
set "CCodeE1code="
:CCodeE1Confirm
cls
Set char=%CCodeE1C:~0,3%
Set CCodeE1C=%CCodeE1C:~1%
Set CCodeE1code=%CCodeE1code%!CHAR[%char%]!
If not "%CCodeE1C%"=="" goto CCodeE1Confirm
Set FinishResult=%CCodeE1code%
Goto End
Set error=0006
Goto ERROR
:End
Cls
Goto End3
:End4
Cls
Echo (Saved To File!)
:End3
Set EndQ=99
TITLE Result - Fireware Encrypt - %WhatEnDe%
Echo.
Echo Start:(%StartResult%)
Echo.
Echo Finish:%FinishResult%
Echo.
Echo.
Echo [S/Save] / [X/Exit]
Set /p EndQ=">>"
If %endq%==S Goto SaveF
If %endq%==s Goto SaveF
If %endq%==X Exit
If %endq%==x Exit
If %endq%==99 Goto End
If not %endq%==99 Goto End
:SaveF
Echo %FinishResult%>>FirewareSave.txt
Goto End4
:Err
:Error
:Errorcode
cls
color fc
TITLE ERRORCODE - Fireware Encrypt
Echo.
Echo                 Fireware has encountered and error and must close.
Echo               For more info please contact me @AustinHD_AS on Twitter
Echo.
Echo                    ERRORCODE: %error%
Echo.
Echo.
Echo Press any key to Exit.
Pause >nul
Exit

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Help needed with building a text encryptor?

#2 Post by Aacini » 12 Nov 2014 23:32

Wow! May I do some comments? Please, don't be offend, but your code suffer from most of the problems that unexperienced Batch file programmers frequently commit! This is a series of casual observations related to your code.


Code like this one:

Code: Select all

Set /p menu=">>"
If %menu%==e goto Encrypt
If %menu%==E goto Encrypt
If %menu%==d goto Decrypt
If %menu%==D goto Decrypt
If %menu%==99 goto MainMenu
If Not %menu%==99 goto MainMenu
:Encrypt

Have several problems:
  • If the user gives no input, "If %menu%==e goto Encrypt" command is executed as: "If ==e goto Encrypt", so it issue an error. The usual way to avoid this problem is enclosing both values in quotes.
  • You may use /I switch in IF command in order to ignore case in the comparison (and not duplicate the IF's).
  • The two last lines have nosense (if X goto Y; if not X goto Y; that is: always goto Y!)
You may use this instead:

Code: Select all

Set /p menu=">>"
If /I "%menu%" == "e" goto Encrypt
If /I "%menu%" == "d" goto Decrypt
goto MainMenu
:Encrypt


This code:

Code: Select all

set Encrypt=

May look confusing. In order to be clearer, it is common to enclose the whole asignment between quotes and place it immediately before the SET /P command:

Code: Select all

set "Encrypt="
Set /p Decrypt=">>"



I don't understand your method to read the letters of the Translation code. I think it would be easier if you first read the whole code and then separate it in individual letters:

Code: Select all

set /P TranslationCode=">>"
rem Separate the code in individual letters:
set count=0
:nextLetter
   set "letter=!TranslationCode:~%count%,1!"
   if "%letter%" == "" goto endLetter
   set /A count+=1
   set L%count%=%letter%
goto nextLetter
:endLetter
rem Process the letters via First, Middle and Last subroutines
for /L %%i in (1,1,%count%) do (
   if %%i equ 1 (
      call :First !L%%i!
   ) else if %%i lss %count% (
      call :Middle !L%%i!
   ) else (
      call :Last !L%%i!
   )
)

Of course, previous method requires to convert the three sections into individual subroutines.

I would generate the array of this section:

Code: Select all

(set CHAR[a]=C) & (set CHAR[b]=A) & (set CHAR[c]=D) & (set CHAR[d]=A) & (set CHAR[e]=B) & (set CHAR[f]=A)
(set CHAR[g]=E) & (set CHAR[h]=B) & (set CHAR[i]=E) & (set CHAR[j]=E) & (set CHAR[k]=D) & (set CHAR[l]=A)
(set CHAR[m]=A) & (set CHAR[n]=C) & (set CHAR[o]=B) & (set CHAR[p]=E) & (set CHAR[q]=D) & (set CHAR[r]=E)
(set CHAR[s]=A) & (set CHAR[t]=E) & (set CHAR[u]=D) & (set CHAR[v]=B) & (set CHAR[w]=A) & (set CHAR[x]=B)
(set CHAR[y]=D) & (set CHAR[z]=B) & (set CHAR[ ]=) & (set CHAR[-]=-)

... this way:

Code: Select all

for %%a in ("a=C" "b=A" "c=D" "d=A" "e=B" "f=A"
            etc, etc...
            "y=D" "z=B" " ="  "-=-") do (
   for /F "tokens=1,2 delims==" %%b in (%%a) do set "CHAR[%%b]=%%c"
)

... and I would NOT generate the array each time it is required, but generate all arrays with different names at beginning just once.


And some other modifications...

Please, note that I did NOT reviewed your program enough to understand what it performs! However, there are several threads in this site related to encryption/decryption; I suggest you to review they.

I hope it helps...

Antonio

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#3 Post by GameRunnerHD » 12 Nov 2014 23:45

Thanks for the feedback, i have been coding batch for a while but i still do noob things cause i remember them easier.
Also, if you dont understand something in the code, quote the part of the code and i will tell you the reason for it.

And about this:
Set /p menu=">>"
If /I "%menu%" == "e" goto Encrypt
If /I "%menu%" == "d" goto Decrypt
goto MainMenu
:Encrypt

I have never heard about that, so thanks!

And why are the quotes needed in:
set "Encrypt="

wouldn't it work just as well without it?

And i dont understand what most of this:
set /P TranslationCode=">>"
rem Separate the code in individual letters:
set count=0
:nextLetter
set "letter=!TranslationCode:~%count%,1!"
if "%letter%" == "" goto endLetter
set /A count+=1
set L%count%=%letter%
goto nextLetter
:endLetter
rem Process the letters via First, Middle and Last subroutines
for /L %%i in (1,1,%count%) do (
if %%i equ 1 (
call :First !L%%i!
) else if %%i lss %count% (
call :Middle !L%%i!
) else (
call :Last !L%%i!
)
)

means.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Help needed with building a text encryptor?

#4 Post by Squashman » 13 Nov 2014 08:00

GameRunnerHD wrote:And about this:
Set /p menu=">>"
If /I "%menu%" == "e" goto Encrypt
If /I "%menu%" == "d" goto Decrypt
goto MainMenu
:Encrypt

I have never heard about that, so thanks!

Read is FUN-DA-MENTAL. Helps if your READ the HELP for the command you are using.

Code: Select all

If Command Extensions are enabled IF changes as follows:

    IF [/I] string1 compare-op string2 command
    IF CMDEXTVERSION number command
    IF DEFINED variable command

where compare-op may be one of:

    EQU - equal
    NEQ - not equal
    LSS - less than
    LEQ - less than or equal
    GTR - greater than
    GEQ - greater than or equal

and the /I switch, if specified, says to do case insensitive string
compares.  The /I switch can also be used on the string1==string2 form
of IF.  These comparisons are generic, in that if both string1 and
string2 are both comprised of all numeric digits, then the strings are
converted to numbers and a numeric comparison is performed.


If your batch file is going to be run on Windows Vista and above you may want to use the CHOICE command instead of SET /P for menu input.

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Help needed with building a text encryptor?

#5 Post by Aacini » 13 Nov 2014 12:19

GameRunnerHD wrote:And why are the quotes needed in:
set "Encrypt="

wouldn't it work just as well without it?

Quotes are not needed:
Aacini wrote:This code:

Code: Select all

set Encrypt=

May look confusing. In order to be clearer, it is common to enclose the whole asignment between quotes...

There are several recommendations that helps to write clearer code. The additional keypresses you spend in these cosmetic details may help to avoid a costly confusion later, when the program needs to be copy/pasted or modified...

GameRunnerHD wrote:And i dont understand what most of this means:


Code: Select all

                                              | Example
set /P TranslationCode=">>"                   | TranslationCode=LOVER
rem Separate the code in individual letters:  |
set count=0                                   | count=     0
:nextLetter                                   | Iteration: 1    2    3    4    5    6
   set "letter=!TranslationCode:~%count%,1!"  | letter=    L    O    V    E    R    ""
   if "%letter%" == "" goto endLetter         |            no   no   no   no   no   yes
   set /A count+=1                            | count=     1    2    3    4    5
   set L%count%=%letter%                      |            L1=L L2=O L3=V L4=E L5=R
goto nextLetter
:endLetter


Antonio

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#6 Post by GameRunnerHD » 13 Nov 2014 16:06

Code: Select all

                                              | Example
set /P TranslationCode=">>"                   | TranslationCode=LOVER
rem Separate the code in individual letters:  |
set count=0                                   | count=     0
:nextLetter                                   | Iteration: 1    2    3    4    5    6
   set "letter=!TranslationCode:~%count%,1!"  | letter=    L    O    V    E    R    ""
   if "%letter%" == "" goto endLetter         |            no   no   no   no   no   yes
   set /A count+=1                            | count=     1    2    3    4    5
   set L%count%=%letter%                      |            L1=L L2=O L3=V L4=E L5=R
goto nextLetter
:endLetter


Wow thanks, This will help so much.
Any idea on how to reverse the text though?(This is needed for the decrypting)

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#7 Post by GameRunnerHD » 13 Nov 2014 16:27

Code: Select all

@Echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set /P TranslationCode=">>"
rem Separate the code in individual letters: 
set count=0                                   
:nextLetter                                   
   set "letter=!TranslationCode:~%count%,1!"
   if "%letter%"=="" goto endLetter
   set /A count+=1
   set L%count%=%letter%
goto nextLetter
:endLetter
Echo Done
If /I %L1%==L Echo L YES!
If /I %L2%==O Echo O YES!
If /I %L3%==V Echo V YES!
If /I %L4%==E Echo E YES!
If /I %L5%==R Echo R YES!
Pause

Should this work as a test? Cause it doesn't.
(I have no idea how this would work)

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Help needed with building a text encryptor?

#8 Post by Squashman » 13 Nov 2014 17:06

Change your SET COUNT to this or make sure there is no spaces after the 0.

Code: Select all

set "count=0"


This would also work if you had a bunch of spaces after the zero.

Code: Select all

 set /a count=0              

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#9 Post by GameRunnerHD » 13 Nov 2014 17:27

THANKYOU! The was EXACTLY why it was crashing.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Help needed with building a text encryptor?

#10 Post by Squashman » 13 Nov 2014 19:57

You would have seen the error in your coding if you would have turned echo on or at least echoed each variable to the screen when running the script.

Another good idea is too write your batch files with Notepad++ and have it show you where the spaces and end of line characters are.

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#11 Post by GameRunnerHD » 13 Nov 2014 21:35

I do use notepad++ but i just didnt see the space

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Help needed with building a text encryptor?

#12 Post by Squashman » 14 Nov 2014 07:40

GameRunnerHD wrote:I do use notepad++ but i just didnt see the space

Probably because you are not displaying them.

Click on View and Show Symbol.
I always have Show End of Line because that will always show you if you have spaces after any line of code.
You could also turn on Show White Space and Tab and that would show you where the spaces were.
Sometimes I just do Show All.

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#13 Post by GameRunnerHD » 14 Nov 2014 13:06

Probably because you are not displaying them.

Click on View and Show Symbol.
I always have Show End of Line because that will always show you if you have spaces after any line of code.
You could also turn on Show White Space and Tab and that would show you where the spaces were.
Sometimes I just do Show All.

Yeah thanks! I turned on "Show White Space and Tab" But i didnt like the look of "Show End of Line"

And guys i still need a way to Reverse my text!
Heres what i need:

Code: Select all

set /p What=">>"
If what==0 goto Encrypt
If what==1 goto Decrypt
:Encrypt
(Encrypts the text)
:Decrypt
Echo Enter Your TranslationCode.
set /p TranCode=">>" (Use "Lover" as a Example)
(TranCode==Lover)
(Reversal Code)
Set TranCodeREV=%TranCode2%
Echo TranCodeREV "revoL"

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Help needed with building a text encryptor?

#14 Post by Squashman » 14 Nov 2014 13:20

GameRunnerHD wrote:And guys i still need a way to Reverse my text!

First link that Google found for me.
http://lmgtfy.com/?q=batch+file+reverse+string

Code: Select all

@echo off

set line=supercalifragilisticexpialidocious
set num=0

:LOOP
call set tmpa=%%line:~%num%,1%%%
set /a num+=1
if not "%tmpa%" equ "" (
set rline=%tmpa%%rline%
goto LOOP
)
echo %rline%

pause

GameRunnerHD
Posts: 9
Joined: 12 Nov 2014 19:09

Re: Help needed with building a text encryptor?

#15 Post by GameRunnerHD » 14 Nov 2014 13:28

First link that Google found for me.
http://lmgtfy.com/?q=batch+file+reverse+string


Code: Select all

@echo off

set line=supercalifragilisticexpialidocious
set num=0

:LOOP
call set tmpa=%%line:~%num%,1%%%
set /a num+=1
if not "%tmpa%" equ "" (
set rline=%tmpa%%rline%
goto LOOP
)
echo %rline%

pause

Wow lol, i never did Google the reversal part. Sometimes the simplest answers are the best. Thanks!

Post Reply