Encrypting a string

Narks

Vastly intelligent whale-like being from the stars
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
Staff member
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.
 

Sevion

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

I studied those in Precalc earlier this week.

<3
 
General chit-chat
Help Users
  • Varine Varine:
    I don't want to compete for that, yall can have it.
  • Varine Varine:
    @The Helper I'm trying. Once I am more prepared to be figuring out school I'll probably ask for your advice
  • Varine Varine:
    Right now I'm just trying to get through the pandemic and figure out how I'm going to pay for it, and figure out what I need to get a job at Best Buy instead of a kitchen somewhere.
  • thewrongvine thewrongvine:
    oy just catching up on the discussion above. @Varine yeah I usually alternate between claritin & zyrtec, depending on whatever my body decides to reject at the time lol
  • thewrongvine thewrongvine:
    the more I use it the less effective it gets over time as my body accustoms to it so I try to not use it every day
  • S songbird:
    Glad to see some interest in the IS3 NUON reprint. :)
    +1
  • The Helper The Helper:
    Thank you Carl for making that happen that just might be the spark we need.
  • Varine Varine:
    I'm confused and amazed that NUON and TWV's news postings are the things still active.
  • Varine Varine:
    Or Tom Mai, not TWV
  • Varine Varine:
    Whatever happened to Cheshire? Or Firecat, whatever his real name was?
  • Varine Varine:
    I've been using both claritin and fexofenadine or something like that recently alternately and that's been kinda working, I don't feel like my face is going to explode at least. Eyes are still itchy as fuck though
  • tom_mai78101 tom_mai78101:
    I dunno, haven't seen Firecat in a long while now.
  • tom_mai78101 tom_mai78101:
    By the way, we have new file attachment size limits now.
  • Varine Varine:
    Are they bigger?
  • tom_mai78101 tom_mai78101:
    Yeah, new max size limit is 64 MB, to accommodate NUON-Dome emulation.
  • Varine Varine:
    I don't think I ever ran into a file size problem before. What was it before?
  • Varine Varine:
    I've had file type issues before I think, but I haven't uploaded anything since like 2010.
  • The Helper The Helper:
    alot smaller than that basically barely anything and it would have been different then 2010 because of the forum upgrade
  • Varine Varine:
    lol I forgot this used to look different
  • Varine Varine:
    It's by far the brightest webpage I regularly visit, the first thing I usually do is try to figure out dark mode.
  • tom_mai78101 tom_mai78101:
    If you invert the colors, The Helper Forums looks amazing
  • tom_mai78101 tom_mai78101:
    It still has that blue theme at the top
  • Ghan Ghan:
    There's no particular hard limit to attachments. "Something reasonable" is preferred to "a size large enough to fill up the server disk"
  • B Badmanhop (Andy):
    I would be interested to.
  • tom_mai78101 tom_mai78101:
    Feel free to contribute to NUON.

    Staff online

    Members online

    Affiliates

    Hive Workshop
    Top