Encode and Decode Strings

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
alleypuppy
Posts: 82
Joined: 24 Apr 2011 19:20

Encode and Decode Strings

#1 Post by alleypuppy » 24 Apr 2011 19:32

Hello. I am trying to create a batch file where I can encode and decode text that I enter, but I am kind of stuck on how to do it. I would like to make it so I can type in "encode [text to be encoded]" or "decode [text to be decoded]" and a result would appear underneath. I would also like to have multiple outcomes for each input. Say I type "encode A", I would like either IZ or IM to appear as the encoded text. I would also like to be able to type in either "decode IZ" or "decode IM" and get the same outcome. I know it's as lot to ask, but any help would be much appreciated! ;)

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Encode and Decode Strings

#2 Post by aGerman » 25 Apr 2011 06:07

Encoding and decoding in batch is absolutely senseless. Batch is plain text, so everybody can see the algorithms. What you would like to do results in batch code with probably much more than 100 lines. I'm not in the mood to write so much code for senseless things. Out of curiosity we tried to write a ROT13 encryption. It's so slow ...

Regards
aGerman

alleypuppy
Posts: 82
Joined: 24 Apr 2011 19:20

Re: Encode and Decode Strings

#3 Post by alleypuppy » 25 Apr 2011 16:07

Okay. Thanks for the info, though!

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Encode and Decode Strings

#4 Post by dbenham » 25 Apr 2011 19:40

I've posted a link to an efficient ROT13 encryption routine at the end of the thread that aGerman referenced. It is able to encrypt a 26k file in around 30 seconds. The code is embedded in a larger library of routines with documentation included. The actual file encryption takes roughly 65 lines of code. It should be possible to modify the code to implement any number of ciphers.

aGerman - How do you edit the displayed text associated with a URL within a post?

Dave Benham

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Encode and Decode Strings

#5 Post by aGerman » 26 Apr 2011 17:20

dbenham wrote:aGerman - How do you edit the displayed text associated with a URL within a post?

This way:

Code: Select all

[url=http://www.dostips.com/forum/faq.php?mode=bbcode#f4r0]BBCode URL[/url]

BBCode URL

Regards
aGerman

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Encode and Decode Strings

#6 Post by dbenham » 26 Apr 2011 17:37

Thanks aGerman - I'll use that next time I post a link.

Dave

Post Reply