Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Hex.decode()


  }

  @Test
  public void retrieveFsEntryID() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes()), "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.SHA1, entryID);

    assertArrayEquals(entryID, KeyUtils.getFsEntryID(rowKey));
  }
View Full Code Here


  @Test
  public void retrieveFsEntryID() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes()), "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.SHA1, entryID);

    assertArrayEquals(entryID, KeyUtils.getFsEntryID(rowKey));
  }
View Full Code Here

  }

  @Test
  public void retrieveImageID() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] imgID = hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(imgID, "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.MD5, entryID);
   
    assertArrayEquals(imgID, KeyUtils.getImageID(rowKey));
View Full Code Here

  @Test
  public void retrieveImageID() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] imgID = hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(imgID, "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.MD5, entryID);
   
    assertArrayEquals(imgID, KeyUtils.getImageID(rowKey));
  }
View Full Code Here

  }

  @Test
  public void isType2() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] imgID = hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(imgID, "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.MD5, entryID);

    assertEquals(true, KeyUtils.isType2(rowKey));
View Full Code Here

  @Test
  public void isType2() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash = hex.decode("deadbeefdeadbeefdeadbeefdeadbeef".getBytes());
    final byte[] imgID = hex.decode("baadf00dbaadf00dbaadf00dbaadf00d".getBytes());
    final byte[] entryID = FsEntryUtils.makeFsEntryKey(imgID, "/etc/passwd".getBytes(), 17);
    final byte[] rowKey = KeyUtils.makeEntryKey(hash, KeyUtils.MD5, entryID);

    assertEquals(true, KeyUtils.isType2(rowKey));
    assertEquals(false, KeyUtils.isType2(hash));
View Full Code Here

public class HexWritableTest {
  @Test
  public void toStringTest() throws Exception {
    final Hex hex = new Hex();
    final String str = "DEADBEEF";
    final HexWritable hw = new HexWritable(hex.decode(str.getBytes()));
    assertEquals(str, hw.toString().toUpperCase());
  }
}
View Full Code Here

  @Test
  public void toStringTest() throws Exception {
    final Hex hex = new Hex();
    final String str = "DEADBEEF";
    final ImmutableHexWritable ihw =
      new ImmutableHexWritable(hex.decode(str.getBytes()));
    assertEquals(str, ihw.toString().toUpperCase());
  }

  @Test
  public void toStringOffsetTest() throws Exception {
View Full Code Here

  @Test
  public void retrieveImageID() throws Exception {
    final Hex hex = new Hex();
    final byte[] hash =
      hex.decode("8a9111fe05f9815fc55c728137c5b389".getBytes());
    final byte[] key = makeFsEntryKey(hash, "/howdy/doody.jpg".getBytes(), 34);
   
    assertArrayEquals(hash, getImageID(key));
  }
}
View Full Code Here

    final MfgData md = new MfgData("ACME", "ACME Corporation");

    final Hex hex = new Hex();
    final byte[] sha1 =
      (byte[]) hex.decode("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
    final byte[] md5 =
      (byte[]) hex.decode("deadbeefdeadbeefdeadbeefdeadbeef");
    final byte[] crc32 = (byte[]) hex.decode("deadbeef");

    final byte[] sha1_col = "sha1".getBytes();
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.