Package dust.core

Examples of dust.core.DustPacket


//    byte[] key=new byte[32];
//    random.nextBytes(key);
    byte[] data="test #3".getBytes();
    DustPRNG entropy=new DustPRNG();

    DustPacket p1=DustPacket.create(key, data, entropy);
    byte[] bytes=p1.getBytes();

    System.out.println("key: "+Util.encode(key));
    System.out.println("p1: "+Util.encode(bytes));
    System.out.println("mac: "+p1.checkMac()+" timestamp: "+p1.checkTimestamp());

    DustPacket p2=DustPacket.decode(key, bytes);
    System.out.println("p2: "+new String(p2.getData()));
    System.out.println("mac: "+p2.checkMac()+" timestamp: "+p2.checkTimestamp());

    DustPacket p3=DustPacket.decode(key, Util.decode(Util.encode(bytes)));
    System.out.println("p3: "+new String(p3.getData()));
    System.out.println("mac: "+p3.checkMac()+" timestamp: "+p3.checkTimestamp());
  }
View Full Code Here

TOP

Related Classes of dust.core.DustPacket

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.