Package ass1

Examples of ass1.Cipher


public class CipherTest {

  @Test
  public void testEncrypt() {
    byte[] input = "ABC".getBytes();
    byte[] result = new Ass1Cipher().encrypt(input);
    assertEquals("FAKFAYXZXZXZ", new String(result));

    input = "supraja\n".getBytes();
    result = new Ass1Cipher().encrypt(input);
    assertEquals("IWSBOXLIBTFWFDAAXZXZXZXZXZXZXZXZ", new String(result));

  }
View Full Code Here


  }

  @Test
  public void testDecrypt() {
    byte[] input = "FAKFAYXZXZXZ".getBytes();
    assertEquals("ABC", new String(new Ass1Cipher().decrypt(input)));

    input = "IWSBOXLIBTFWFDAAXZXZXZXZXZXZXZXZ".getBytes();
    assertEquals("supraja\n", new String(new Ass1Cipher().decrypt(input)));
  }
View Full Code Here

              .getText());
          InputStream input = null;
          if (encryptButton.isSelected()) {
            EncryptionInputStream eis = new EncryptionInputStream(
                fis);
            eis.setCipher(new Ass1Cipher());
            input = eis;
          } else {
            DecryptionInputStream dis = new DecryptionInputStream(
                fis);
            dis.setCipher(new Ass1Cipher());
            input = dis;
          }
          IOUtils.copy(input, fos);
          fis.close();
          fos.close();
View Full Code Here

            EncryptionInputStream eis = new EncryptionInputStream(
                fis);
            eis.setCipher(new Ass1Cipher());
            input = eis;
          } else {
            DecryptionInputStream dis = new DecryptionInputStream(
                fis);
            dis.setCipher(new Ass1Cipher());
            input = dis;
          }
          IOUtils.copy(input, fos);
          fis.close();
          fos.close();
View Full Code Here

              .getText());
          fos = new FileOutputStream(outputChooser.getTextField()
              .getText());
          InputStream input = null;
          if (encryptButton.isSelected()) {
            EncryptionInputStream eis = new EncryptionInputStream(
                fis);
            eis.setCipher(new Ass1Cipher());
            input = eis;
          } else {
            DecryptionInputStream dis = new DecryptionInputStream(
                fis);
            dis.setCipher(new Ass1Cipher());
View Full Code Here

TOP

Related Classes of ass1.Cipher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.