1
1
using System ;
2
2
3
+ using Org . BouncyCastle . Utilities ;
4
+
3
5
namespace Org . BouncyCastle . Math . EC . Multiplier
4
6
{
5
7
public abstract class WNafUtilities
@@ -8,16 +10,14 @@ public abstract class WNafUtilities
8
10
9
11
private static readonly int [ ] DEFAULT_WINDOW_SIZE_CUTOFFS = new int [ ] { 13 , 41 , 121 , 337 , 897 , 2305 } ;
10
12
11
- private static readonly byte [ ] EMPTY_BYTES = new byte [ 0 ] ;
12
- private static readonly int [ ] EMPTY_INTS = new int [ 0 ] ;
13
13
private static readonly ECPoint [ ] EMPTY_POINTS = new ECPoint [ 0 ] ;
14
14
15
15
public static int [ ] GenerateCompactNaf ( BigInteger k )
16
16
{
17
17
if ( ( k . BitLength >> 16 ) != 0 )
18
18
throw new ArgumentException ( "must have bitlength < 2^16" , "k" ) ;
19
19
if ( k . SignValue == 0 )
20
- return EMPTY_INTS ;
20
+ return Arrays . EmptyInts ;
21
21
22
22
BigInteger _3k = k . ShiftLeft ( 1 ) . Add ( k ) ;
23
23
@@ -63,7 +63,7 @@ public static int[] GenerateCompactWindowNaf(int width, BigInteger k)
63
63
if ( ( k . BitLength >> 16 ) != 0 )
64
64
throw new ArgumentException ( "must have bitlength < 2^16" , "k" ) ;
65
65
if ( k . SignValue == 0 )
66
- return EMPTY_INTS ;
66
+ return Arrays . EmptyInts ;
67
67
68
68
int [ ] wnaf = new int [ k . BitLength / width + 1 ] ;
69
69
@@ -176,7 +176,7 @@ public static byte[] GenerateJsf(BigInteger g, BigInteger h)
176
176
public static byte [ ] GenerateNaf ( BigInteger k )
177
177
{
178
178
if ( k . SignValue == 0 )
179
- return EMPTY_BYTES ;
179
+ return Arrays . EmptyBytes ;
180
180
181
181
BigInteger _3k = k . ShiftLeft ( 1 ) . Add ( k ) ;
182
182
@@ -221,7 +221,7 @@ public static byte[] GenerateWindowNaf(int width, BigInteger k)
221
221
if ( width < 2 || width > 8 )
222
222
throw new ArgumentException ( "must be in the range [2, 8]" , "width" ) ;
223
223
if ( k . SignValue == 0 )
224
- return EMPTY_BYTES ;
224
+ return Arrays . EmptyBytes ;
225
225
226
226
byte [ ] wnaf = new byte [ k . BitLength + 1 ] ;
227
227
0 commit comments