Skip to content

Commit 6382765

Browse files
author
tom zhou
committed
added 100M big buffer box stress test
1 parent be227d3 commit 6382765

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/com/iwebpp/crypto/tests/TweetNaclFastTest.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,26 +163,28 @@ private boolean testBox() throws UnsupportedEncodingException {
163163
}
164164

165165
// cipher B -> A
166-
byte [] b0 = new byte[6];
166+
byte [] b0 = new byte[100*1000000];
167+
for (int i = 0; i < b0.length; i ++)
168+
b0[i] = (byte)i;
167169

168-
Log.d(TAG, "box@" + System.currentTimeMillis());
170+
Log.d(TAG, "big of 100M box@" + System.currentTimeMillis());
169171
byte [] cba = pba.box(b0);
170172
byte [] mab = pab.open(cba);
171-
Log.d(TAG, "open@" + System.currentTimeMillis());
173+
Log.d(TAG, "big of 100M open@" + System.currentTimeMillis());
172174

173175
if (b0.length == mab.length) {
174176
int rc = 0;
175177

176178
for (int i = 0; i < b0.length; i ++)
177179
if (!(b0[i] == mab[i])) {
178180
rc = -1;
179-
Log.e(TAG, "box/open binary failed @" + b0[i] + " / " + mab[i]);
181+
Log.e(TAG, "big of 100M box/open binary failed @" + b0[i] + " / " + mab[i]);
180182
}
181183

182184
if (rc == 0)
183-
Log.d(TAG, "box/open binary success @" + b0);
185+
Log.d(TAG, "big of 100M box/open binary success @" + b0);
184186
} else {
185-
Log.e(TAG, "box/open binary failed @" + b0 + " / " + mab);
187+
Log.e(TAG, "big of 100M box/open binary failed @" + b0 + " / " + mab);
186188
}
187189

188190
return true;
@@ -537,14 +539,14 @@ public void run() {
537539
Log.d(TAG, "start test");
538540

539541
try {
540-
testSecretBox();
541-
testSecretBoxNonce();
542+
///testSecretBox();
543+
///testSecretBoxNonce();
542544
testBox();
543-
testBoxNonce();
544-
testBoxKalium();
545+
///testBoxNonce();
546+
///testBoxKalium();
545547

546-
testHash();
547-
testSign();
548+
///testHash();
549+
///testSign();
548550

549551
///testBench();
550552
} catch (UnsupportedEncodingException e) {

0 commit comments

Comments
 (0)