Encrypting a string

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
Does anyone know of a snippet where you can add two strings (lets say a constant and a player's name) to get a new string through some kind of shifting or something - and the reverse operation, where you subtract a player's name from a string to get the original string?

I don't know much about encryption... :x

EDIT: Okay, I'll be less lazy - if I wanted to do this, I'd convert a string to an array of integers using a character map, then I'd convert the player's name to an array of integers using a character map, then I'd... sum up the player's name to get a total, and then add it to every character in the string, then divide each character by the size of the character map to get the remainder of each character, then convert the remainder of each character to a string.

For the reverse operation, I'd convert the string to an integer array, subtract the total of the name, then do the same divison / remainder stuff...

Is this right?
 

tooltiperror

Super Moderator
Reaction score
231
Well what you could do is make a doubly linked list of the alphabet with each letter's ASCII value pointing to a struct instance, then use a Caesar Cipher to replace each letter with [ljass]letter.next[/ljass], then the reverse is doing [ljass]letter.prev[/ljass]. If you wanted to you could make a shuffle method in the struct, and as long as you keep that exact struct around you can decode it.

The next step you could take it would be to randomize it some more and do a fixed letter replacement, but using a Substitution Cipher. These codes are sometimes as simple as the Caesar Ciphar (which is a simple form of a substitution cipher) and they can be quite effective.

An effective way of doing it the way you want to do it could be to use a Substitution Cipher, exchange each letter for two integers/characters (use Hex) then covert to a smaller base to shrink the data, then convert up. You can also throw in tricks like adding the total amount of characters up and then appending it as the third character or whatever floats your boat. This is Warcraft III, no one should be able to crack your encryption method. For extra security, I guess you could also try hiding some stuff in gamecache.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
oh, its called a caesar cipher

thanks
 

Sevion

The DIY Ninja
Reaction score
424
You should use a Hill Cipher or the RSA Cryptosystem.

I studied those in Precalc earlier this week.

<3
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top