Skip to content

Commit 9c24dbf

Browse files
committed
Delete unused code.
Signed-off-by: Bradley Grainger <[email protected]>
1 parent 06d4da7 commit 9c24dbf

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/MySqlConnector.Authentication.Ed25519/Chaos.NaCl/CryptoBytes.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
using System;
1+
using System;
22
using System.Runtime.CompilerServices;
33

44
namespace Chaos.NaCl
55
{
66
internal static class CryptoBytes
77
{
8-
public static bool ConstantTimeEquals(byte[] x, int xOffset, byte[] y, int yOffset, int length)
9-
{
10-
if (x == null)
11-
throw new ArgumentNullException("x");
12-
if (xOffset < 0)
13-
throw new ArgumentOutOfRangeException("xOffset", "xOffset < 0");
14-
if (y == null)
15-
throw new ArgumentNullException("y");
16-
if (yOffset < 0)
17-
throw new ArgumentOutOfRangeException("yOffset", "yOffset < 0");
18-
if (length < 0)
19-
throw new ArgumentOutOfRangeException("length", "length < 0");
20-
if (x.Length - xOffset < length)
21-
throw new ArgumentException("xOffset + length > x.Length");
22-
if (y.Length - yOffset < length)
23-
throw new ArgumentException("yOffset + length > y.Length");
24-
25-
return InternalConstantTimeEquals(x, xOffset, y, yOffset, length) != 0;
26-
}
27-
28-
private static uint InternalConstantTimeEquals(byte[] x, int xOffset, byte[] y, int yOffset, int length)
29-
{
30-
int differentbits = 0;
31-
for (int i = 0; i < length; i++)
32-
differentbits |= x[xOffset + i] ^ y[yOffset + i];
33-
return (1 & (unchecked((uint)differentbits - 1) >> 8));
34-
}
35-
368
public static void Wipe(byte[] data)
379
{
3810
if (data == null)

0 commit comments

Comments
 (0)