ID:149532
 
Maybe this should go in newboob's? Maybe not?
Oh well, I was wondering if there is a way to encrypt a word into 3-digit numbers (ex. a=101,b=123,c=789,etc)and then put those numbers into a string (ex. hello=101123789) and then take the length of the encryption password (ex. pass=4,hi=2,mommy=5,etc.) and multiply the string by that number, resulting something like (4x101123789). Then, here's the tricky part...decrypting that....how would you decrypt it....divide inputed number by password length (4) then what? You have a string of numbers, how are you going to split it in threes with BYOND DM ?


Anyhelp would be gratefull,
thankZ,
¤unimatrix¤
I dont know if it is too late, but here is my answer anyways.

Basic rules of math, when trying to go backwards (decrypting, it's common sense to do reverse operations. If you multiplied by length("[password]"), then divide by that as well.

As for taking numbers in groups of three, try running a loop through the text like this.

proc/decrypt(text)
var/tmp/start=-2
var/tmp/stop=1
var/tmp/returntext
while(1)
start+=3
stop+=3
var/foundtext=copytext(text,start,stop)
if(foundtext=="111")
returntext+="A"
if(foundtext=="777")
returntext+="B"
if(foundtext=="888")
returntext+="C"
if(foundtext=="999")
returntext+="D"
if(start>length(text))
return returntext

Alright, I'm pretty sure that will work. I did no tests though. If you were to have something like.

var/A=decrypt("888777111999")
world << "[A]"

The world should see CBAD
Also, make sure when you use decrypt, you make it divide the provided numbers by 10 before you see what they equal and go replacing stuff. And you can do a set of 3 numbers for both uppercase and lowercase letters.