# Securely computing functions over source code

I have been studying multi-party computation and want to start implementing it. I think it would be interesting to do this where one of the inputs (say party 1) is some source code, say a .py file.

If for example I wanted to securely compute the number of lines of code this file had, how would I go about it? The functionality would look something like $$f(code.py, \_) = (\_, \text{number of lines in code.py})$$ where $$\_$$ represents the empty string.

I think MPC is up to this task but are there any better ways this functionality could be realised?

Also, any pointers to packages that would be good to implement this in would be nice also.

• When you say "number of lines of code" you mean excluding blank lines and comments or you just mean the number of lines the file has? And is $f$ known only by the client? I mean, the server, which holds the file, is supposed to known that the client just want to count lines or it must run the protocol as if $f$ could be something else? Jul 25 '19 at 7:41
• Yes excluding blank lines and comments. The functionality is publicly known. Essentially want to count the lines that are not blank and not comments without leaking information other information about code.py (which is a private input).
– LDG
Jul 25 '19 at 8:01
• That is not really a good scenario for multi-party computation, since the server can just count the lines, encrypt, and send it to the client. Interesting examples use functions $f$ that have two inputs, $c$, known by the client and $s$, known by the server. Then they want to compute $f(c, s)$ without disclosing their values (so, each party cannot compute $f(c, s)$ alone)... Jul 25 '19 at 11:24