Posted 01 March 2014 - 10:42 PM
I am looking into creating an "encryption" (it is closer to a one-way hash system) system used so that data can be transferred over rednet, etc. in non-plaintext form, as well as other situations where non-plaintext would be necessary/preferred.
Because I don't know how to set up MD5 hashing (not sure how to create my own lua hasher and I don't think the http API would be useful here), I'm instead creating my own "hasher" (again, not really a hasher) that works as follows (in the context of a password program):
Inputted characters are converted to their ASCII numerical forms (codes 32-127) and the numerical values are added up. The resulting value is then put through a number of mathematical operations and finally compared to a pre-hashed value stored in the program (which is the stored password); if they match, the correct password was entered. If they do not match, an incorrect password was entered.
I know, the fact that the hashing process is stored in the program makes this somewhat easy to crack, but I'm doing it for the hell of it.
Are there any fast/easy ways to do this? I know I could do it through a ton of if statements, but that is incredibly slow, inefficient, and not ideal. A switch statement (are those in Lua? I'm coming from Java) could also work and be slightly faster, but still quite bad.
Thanks!
Because I don't know how to set up MD5 hashing (not sure how to create my own lua hasher and I don't think the http API would be useful here), I'm instead creating my own "hasher" (again, not really a hasher) that works as follows (in the context of a password program):
Inputted characters are converted to their ASCII numerical forms (codes 32-127) and the numerical values are added up. The resulting value is then put through a number of mathematical operations and finally compared to a pre-hashed value stored in the program (which is the stored password); if they match, the correct password was entered. If they do not match, an incorrect password was entered.
I know, the fact that the hashing process is stored in the program makes this somewhat easy to crack, but I'm doing it for the hell of it.
Are there any fast/easy ways to do this? I know I could do it through a ton of if statements, but that is incredibly slow, inefficient, and not ideal. A switch statement (are those in Lua? I'm coming from Java) could also work and be slightly faster, but still quite bad.
Thanks!