|
From: <pe...@us...> - 2004-01-18 21:20:23
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto
In directory sc8-pr-cvs1:/tmp/cvs-serv28561/src/test/org/neuclear/commons/crypto
Modified Files:
Base32Tests.java
Log Message:
Created Base32 encoder that now fully complies with Tyler's spec.
Index: Base32Tests.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/Base32Tests.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Base32Tests.java 16 Jan 2004 23:41:59 -0000 1.1
--- Base32Tests.java 18 Jan 2004 21:20:20 -0000 1.2
***************
*** 23,26 ****
--- 23,29 ----
$Id$
$Log$
+ Revision 1.2 2004/01/18 21:20:20 pelle
+ Created Base32 encoder that now fully complies with Tyler's spec.
+
Revision 1.1 2004/01/16 23:41:59 pelle
Added Base32 class. The Base32 encoding used wasnt following the standards.
***************
*** 44,61 ****
assertEquals(10,Base32.encode("hello1").length());
assertEquals(12,Base32.encode("hello12").length());
! assertEquals(9,Base32.encode("hello123").length());
! assertEquals(14,Base32.encode("hello1234").length());
! assertEquals(15,Base32.encode("hello12345").length());
! assertEquals(16,Base32.encode("hello123456").length());
for (int i=0;i<TESTSTRINGS.length;i++){
! assertEquals(TESTSTRINGS[i],new String(Base32.decode(Base32.encode(TESTSTRINGS[i]))));
}
}
static final String TESTSTRINGS[] =new String[]{
! "0123456789",
! "",
"0",
! "abcde56"
};
--- 47,75 ----
assertEquals(10,Base32.encode("hello1").length());
assertEquals(12,Base32.encode("hello12").length());
! assertEquals(13,Base32.encode("hello123").length());
! assertEquals(15,Base32.encode("hello1234").length());
! assertEquals(16,Base32.encode("hello12345").length());
! assertEquals(18,Base32.encode("hello123456").length());
for (int i=0;i<TESTSTRINGS.length;i++){
! System.out.print("Encoding: "+TESTSTRINGS[i]+" ...");
! final String encoded = Base32.encode(TESTSTRINGS[i]);
! System.out.println(" ->"+encoded);
! assertEquals(TESTSTRINGS[i],new String(Base32.decode(encoded)));
}
}
static final String TESTSTRINGS[] =new String[]{
! // "",
"0",
! "01",
! "012",
! "0123",
! "01234",
! "012345",
! "0123456",
! "01234567",
! "012345678",
! "0123456789",
! "0123456789A",
};
|