示例#1
0
  @Test
  public void testLoop() throws UnsupportedEncodingException {

    long reps = 10000;
    while (reps-- > 0) {
      String s = RandomStringUtil.randomAscii(MathUtil.randomInt(1, 1024));
      byte[] encrypted = threefish.encryptString(s);
      String s2 = threefish.decryptString(encrypted);
      assertEquals(s, s2);
    }
  }
示例#2
0
  @Test
  public void testSimple() throws UnsupportedEncodingException {
    String message = "Threefish!";
    byte[] encrypted = threefish.encryptString(message);
    String message2 = threefish.decryptString(encrypted);
    assertEquals(message, message2);

    message =
        "Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!Jodd was here!";
    encrypted = threefish.encryptString(message);
    message2 = threefish.decryptString(encrypted);

    assertEquals(message, message2);
  }
示例#3
0
 @Before
 public void setUp() throws Exception {
   threefish = new Threefish(Threefish.BLOCK_SIZE_BITS_1024);
   threefish.init(
       "This is a key message and I feel good", 0x1122334455667788L, 0xFF00FF00AABB9933L);
 }