diff NaCl/crypto_verify/32.cs @ 20:c873e3dd73fe

Added NaCl cryptography code
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 15 Apr 2013 00:43:48 +0200
parents
children b5e27116bd2a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NaCl/crypto_verify/32.cs	Mon Apr 15 00:43:48 2013 +0200
@@ -0,0 +1,12 @@
+using System;
+
+namespace UCIS.NaCl.crypto_verify {
+	unsafe static class _32 {
+		const int BYTES = 32;
+		public static int crypto_verify(Byte* x, Byte* y) {
+			Int32 differentbits = 0;
+			for (int i = 0; i < 31; i++) differentbits |= x[i] ^ y[i];
+			return (1 & ((differentbits - 1) >> 8)) - 1;
+		}
+	}
+}
\ No newline at end of file