Mercurial > hg > ucis.core
comparison NaCl/crypto_verify/16.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 |
comparison
equal
deleted
inserted
replaced
19:b9ef273964fd | 20:c873e3dd73fe |
---|---|
1 using System; | |
2 | |
3 namespace UCIS.NaCl.crypto_verify { | |
4 unsafe static class _16 { | |
5 const int BYTES = 16; | |
6 public static int crypto_verify(Byte* x, Byte* y) { | |
7 Int32 differentbits = 0; | |
8 for (int i = 0; i < 15; i++) differentbits |= x[i] ^ y[i]; | |
9 return (1 & ((differentbits - 1) >> 8)) - 1; | |
10 } | |
11 } | |
12 } |