The current generation of AlgoMachines’ protected code runs on Windows x64 operating systems. Here is a simple program:
void main(STRING password)
{
uint64 niter, hash;
niter = 1;
// Hash the password with one iteration
hash_string_to_uint64(hash,password,niter);
// Use the hash as an expected value, only a password
// which hashes to the expected value will work
protected_function(password, hash);//EV(hash,2331711661754986680)
}
void protected_function(STRING password, uint64 hash)
{
// Construct a message including the password and hash
// This will only work if the hash has the expected value when
// this function is called.
STRING s;
s = "password=";
to_stdout(s); // send the string to the console stdout
to_stdout(password);
s = "\nhash=";
to_stdout(s);
s = hash;
to_stdout(s);
s = "\n";
to_stdout(s);
}
Using AlgoMachines’ compiler, the program is compiled to a binary file which may be run via our binary runtime module.
Each function call in the program may have an expected value associated with it. Note the comment after the function call: //EV(hash,2331711661754986680)
When an expected value is provide to the compiler, the generated binary code for that function call is encrypted accordingly. At run time, if the value of the parameter does not match the expected value, then decryption of the function’s binary code generates random data and program execution fails.
In the above example, the STRING variable password must have value “0123456789ABCDEFGHIJ” in order to generate a hash matching the expected value.
Here’s the Windows batch file that I used to generate the binary from the above source code:
:: Demo1.code - file containing the source code
:: Demo1.params - file containing the parameter value to pass into the
:: program (after it is compiled for testing)
:: content of the params file is a single line:
:: STRING p1 = "0123456789ABCDEFGHIJ"
:: Demo1Password - the root level password for the binary output
:: Demo1.bin - name of the file where the binary output will be saved
..\BIN\CompilerV1.exe Demo1.code Demo1.params Demo1Password Demo1.bin
Here’s the command line that I used to run the program:
RunProtectedCode "Demo1.bin" "Demo1Password" "0123456789ABCDEFGHIJ"
Output from the program is sent to the to stdout for the command window:

Thanks for your blog, nice to read. Do not stop.
Good post.