The SecreC language
Introducing the SecreC programming language
SecreC (pronounced: "secrecy") is a novel programming language that separates public and private data on the type system. This means that you can define which data in your algorithm is supposed to be secret and which can remain public.
We provide a system for running SecreC programs on the Sharemind virtual machine. This means that secret data is processed using secure multi-party computation and public data is processed as usual. Such a hybrid execution environment allows the algorithm developer to balance performance with security.
Designed for programmers
The programmer does not have to be a cryptographer. Instead of writing the program down in the form of a protocol, the developers write the algorithm in the same way as in any other language. The SecreC compiler and the Sharemind machine take care of running the necessary secure computation operation exactly when they are needed.
The language is inspired by C, but we have added a range of features to simplify algorithm development. Support for vectors, matrices and parallel operations simplify the creation of data mining algorithms. The language API supports operations with the Sharemind private database.
Control what is published
The developer has complete control over the declassification and publishing of private data.
public int countAnswers (private int answer, private int[] allAnswers) { public int n; n = getRowCount(allAnswers);
// An indicator vector of ones and zeroes private bool[n] comparisonVector; comparisonVector = (allAnswers == answer);
private int sum; sum = vecSum(comparisonVector);}
public int count; count = declassify(sum);
return count;
This code computes all comparisons privately and in parallel. The resulting boolean vector can be summed to learn the number of correct results. This sum is then declassified and nothing else is leaked.
Start developing
Developing is easy with the special SecreCIDE integrated development environment. SecreCIDE is included in the SecreC SDK together with a development version of the Sharemind virtual machine and the SecreC compiler. Download the SDK from the menu on the left.

