A method for performing secure inference over deep neural networks, DNNs, using secure two-party computation to perform privacy-preserving machine learning such that the provider of the DNN does not learn anything about inputs to the DNN, and such that the provider of inputs to the DNN does not learn anything about weights of the DNN beyond that which can be inferred from the output of the DNN and the inputs to the DNN, the method comprising: performing a comparison that securely computes a Boolean share of a bit; and repeatedly performing the comparison for different inputs to traverse a garbled binary circuit that represents the DNN to thereby obtain a result of the garbled circuit; characterized in that the bit represents whether input value x is less than input value y, where x is held by a user of the DNN, and where y is held by a provider of the DNN, and the comparison performed by: parsing (201A, 201B) x into q leaf strings x q-1...x 0, where each of the q leaf strings is more than one bit, and where x is equal to the concatenation x q-1 ∥... ∥ x 0; compute (211A, 211B) shares (221A, 221B) of inequality 1{ x n < y n} for each of at least some n from q -1 down to 1, where y is equal to the concatenation y q-1 ∥... ∥ y 0, by in each case using oblivious transfer; compute (212A, 212B) shares (222A, 222B) of equality 1{ x n = y n} for each of at least some n from q -1 down to 1 also in each case by using oblivious transfer; and recursively calculating shares of inequality of internal nodes according to the following equation: 1{ x C <y C}=1{ xB<yB}⊕(1{ x B = y B}∧1{ x A <y A}) (where x C = x B ∥ x A, and y C = y B ∥ y A), and shares of equality of internal nodes until the Boolean share of 1{ x < y} is determined. performing a comparison that securely computes a Boolean share of a bit; and repeatedly performing the comparison for different inputs to traverse a garbled binary circuit that represents the DNN to thereby obtain a result of the garbled circuit; characterized in that the bit represents whether input value x is less than input value y, where x is held by a user of the DNN, and where y is held by a provider of the DNN, and the comparison performed by: parsing (201A, 201B) x into q leaf strings x q-1...x 0, where each of the q leaf strings is more than one bit, and where x is equal to the concatenation x q-1 ∥... ∥ x 0; compute (211A, 211B) shares (221A, 221B) of inequality 1{ x n < y n} for each of at least some n from q -1 down to 1, where y is equal to the concatenation y q-1 ∥... ∥ y 0, by in each case using oblivious transfer; compute (212A, 212B) shares (222A, 222B) of equality 1{ x n = y n} for each of at least some n from q -1 down to 1 also in each case by using oblivious transfer; and recursively calculating shares of inequality of internal nodes according to the following equation: 1{ x C <y C}=1{ xB<yB}⊕(1{ x B = y B}∧1{ x A <y A}) (where x C = x B ∥ x A, and y C = y B ∥ y A), and shares of equality of internal nodes until the Boolean share of 1{ x < y} is determined. parsing (201A, 201B) x into q leaf strings x q-1...x 0, where each of the q leaf strings is more than one bit, and where x is equal to the concatenation x q-1 ∥... ∥ x 0; compute (211A, 211B) shares (221A, 221B) of inequality 1{ x n < y n} for each of at least some n from q -1 down to 1, where y is equal to the concatenation y q-1 ∥... ∥ y 0, by in each case using oblivious transfer; compute (212A, 212B) shares (222A, 222B) of equality 1{ x n = y n} for each of at least some n from q -1 down to 1 also in each case by using oblivious transfer; and recursively calculating shares of inequality of internal nodes according to the following equation: 1{ x C <y C}=1{ xB<yB}⊕(1{ x B = y B}∧1{ x A <y A}) (where x C = x B ∥ x A, and y C = y B ∥ y A), and shares of equality of internal nodes until the Boolean share of 1{ x < y} is determined.