Posted 05 April 2014 - 11:55 PM
So I've recently been thinking about a way to make a more modular and customizable form of a security system I'm working on (previously mentioned here) in which a user inputs a password, which then gets converted to a number, based on the numerical value attached (by the system) to each key that is pressed. Then, said number is processed through a somewhat complex algebraic equation in order to change it to something that can't simply be pulled up next to a keycode chart and translated directly into a password by an unwanted third party, who "happens to have received this transmission." *angrily grumbles something about dirty hackers*
Anywho, I was wondering how to make the system more, well, modular, meaning that there would be two files: one containing the actual meat and muscle of the program, which acts on user input etc, etc, but is never changed, and the other file contains lines that are to be applied to variables in the program. But, one of these lines that I need to apply to a variable is the algebraic equation, which, according to the Wiki gets read as a string. Well, "result = '((-4)(x)((3+2(x))^2)'" isn't going to work, because then the result is just gonna be a printed string, instead of a processed number.
Is there a way to convert this to… a less mathematically challenged form of input lol?
a sample of my current code is something like this:
context: the program itself is called alpha, and the file with the list of variables is called beta. The equation is the first line of beta.
I used the (current) real equation above: ((-4)(x)((3+2(x))^2)
Anywho, I was wondering how to make the system more, well, modular, meaning that there would be two files: one containing the actual meat and muscle of the program, which acts on user input etc, etc, but is never changed, and the other file contains lines that are to be applied to variables in the program. But, one of these lines that I need to apply to a variable is the algebraic equation, which, according to the Wiki gets read as a string. Well, "result = '((-4)(x)((3+2(x))^2)'" isn't going to work, because then the result is just gonna be a printed string, instead of a processed number.
Is there a way to convert this to… a less mathematically challenged form of input lol?
a sample of my current code is something like this:
var = 45
x = var
filehandle = fs.open("beta", "r")
equation = filehandle.readLine()
n = tonumber(equation)
context: the program itself is called alpha, and the file with the list of variables is called beta. The equation is the first line of beta.
I used the (current) real equation above: ((-4)(x)((3+2(x))^2)