Package ch.ethz.inf.vs.scandium.util

Examples of ch.ethz.inf.vs.scandium.util.DatagramWriter.writeLong()


    writer.write(version.getMajor(), VERSION_BITS);
    writer.write(version.getMinor(), VERSION_BITS);

    writer.write(epoch, EPOCH_BITS);
    writer.writeLong(sequenceNumber, SEQUENCE_NUMBER_BITS);

    length = fragmentBytes.length;
    writer.write(length, LENGTH_BITS);

    writer.writeBytes(fragmentBytes);
View Full Code Here


   
    //TODO: re-factor to use simple byte array manipulation instead of using bit-based DatagramWriter
    DatagramWriter writer = new DatagramWriter();
   
    writer.write(epoch, EPOCH_BITS);
    writer.writeLong(sequenceNumber, SEQUENCE_NUMBER_BITS);
   
    return writer.toByteArray();
  }

  /**
 
View Full Code Here

   */
  private byte[] generateAdditionalData(int length) {
    DatagramWriter writer = new DatagramWriter();
   
    writer.write(epoch, EPOCH_BITS);
    writer.writeLong(sequenceNumber, SEQUENCE_NUMBER_BITS);

    writer.write(type.getCode(), CONTENT_TYPE_BITS);

    writer.write(version.getMajor(), VERSION_BITS);
    writer.write(version.getMinor(), VERSION_BITS);
View Full Code Here

       */

      DatagramWriter writer = new DatagramWriter();
      if (lengthA > 0 && lengthA < first) {
        // 2 bytes (0x0001 ... 0xFEFF)
        writer.writeLong(lengthA, 16);

      } else if (lengthA >= first && lengthA < second) {
        // 2 bytes (0xFFFE) + 4 octets of l(a)
        int field = 0xFFFE;
        writer.write(field, 16);
View Full Code Here

      } else if (lengthA >= first && lengthA < second) {
        // 2 bytes (0xFFFE) + 4 octets of l(a)
        int field = 0xFFFE;
        writer.write(field, 16);
        writer.writeLong(lengthA, 32);

      } else {
        // 2 bytes (0xFFFF) + 8 octets of l(a)
        int field = 0xFFFF;
        writer.write(field, 16);
View Full Code Here

      } else {
        // 2 bytes (0xFFFF) + 8 octets of l(a)
        int field = 0xFFFF;
        writer.write(field, 16);
        writer.writeLong(lengthA, 64);
      }
      writer.writeBytes(a);

      byte[] aEncoded = writer.toByteArray();
      blocks.addAll(ByteArrayUtils.splitAndPad(aEncoded, BLOCK_SIZE));
View Full Code Here

      // the Nonce N
      writer.writeBytes(nonce);

      // writer the Counter i (L bytes)
      writer.writeLong(i, L * 8);
      byte[] S = writer.toByteArray();

      // S_i := E( K, A_i )
      S_i.add(ByteArrayUtils.truncate(cipher.doFinal(S), BLOCK_SIZE));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.