Skip to content

Commit bfa82f1

Browse files
author
gefeili
committed
Minor changes in GF16.encode
1 parent f76b52a commit bfa82f1

File tree

1 file changed

+4
-4
lines changed
  • core/src/main/java/org/bouncycastle/util

1 file changed

+4
-4
lines changed

core/src/main/java/org/bouncycastle/util/GF16.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ public static void decode(byte[] input, int inOff, byte[] output, int outOff, in
134134
*/
135135
public static void encode(byte[] input, byte[] output, int inputLen)
136136
{
137-
int i, inOff = 0;
137+
int i, inOff = 0, blocks = inputLen >> 1;
138138
// Process pairs of 4-bit values
139-
for (i = 0; i < inputLen / 2; i++)
139+
for (i = 0; i < blocks; i++)
140140
{
141141
int lowerNibble = input[inOff++] & 0x0F;
142142
int upperNibble = (input[inOff++] & 0x0F) << 4;
@@ -151,9 +151,9 @@ public static void encode(byte[] input, byte[] output, int inputLen)
151151

152152
public static void encode(byte[] input, byte[] output, int outOff, int inputLen)
153153
{
154-
int i, inOff = 0;
154+
int i, inOff = 0, blocks = inputLen >> 1;
155155
// Process pairs of 4-bit values
156-
for (i = 0; i < inputLen / 2; i++)
156+
for (i = 0; i < blocks; i++)
157157
{
158158
int lowerNibble = input[inOff++] & 0x0F;
159159
int upperNibble = (input[inOff++] & 0x0F) << 4;

0 commit comments

Comments
 (0)