Examples of Hex


Examples of org.apache.commons.codec.binary.Hex

    assertArrayEquals(expected, makeFsEntryKey(img_md5, path, dir_index));
  }

  @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

Examples of org.apache.commons.codec.binary.Hex

      "roadrunner exterminator"
    );

    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();
    final byte[] md5_col = "md5".getBytes();
    final byte[] crc32_col = "crc32".getBytes();
    final byte[] size_col = "filesize".getBytes();
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

    super(bytes);
  }

  @Override
  public String toString() {
    final Hex hex = new Hex();
    final byte[] bytes = new byte[getLength()];
    System.arraycopy(getBytes(), 0, bytes, 0, bytes.length);
    return new String(hex.encode(bytes));
  }
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

      long compactID = Long.parseLong(tokens[0]);
     
      CompactionIterators iters = new CompactionIterators();

      if (tokens.length > 1) {
        Hex hex = new Hex();
        ByteArrayInputStream bais = new ByteArrayInputStream(hex.decode(tokens[1].split("=")[1].getBytes(Constants.UTF8)));
        DataInputStream dis = new DataInputStream(bais);
       
        try {
          iters.readFields(dis);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

          }

          StringBuilder encodedIterators = new StringBuilder();

          if (iterators != null) {
            Hex hex = new Hex();
            encodedIterators.append(",");
            encodedIterators.append(txidString);
            encodedIterators.append("=");
            encodedIterators.append(new String(hex.encode(iterators), Constants.UTF8));
          }
         
          return (Long.toString(flushID) + encodedIterators).getBytes(Constants.UTF8);
        }
      });
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

            SecretKey secret = new SecretKeySpec(secretByte, "HMACSHA256");
            mac.init(secret);

            byte[] doFinal = mac.doFinal(dataBytes);
            byte[] hexB = new Hex().encode(doFinal);
            return new String(hexB, "utf-8");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

          }

          StringBuilder encodedIterators = new StringBuilder();

          if (iterators != null) {
            Hex hex = new Hex();
            encodedIterators.append(",");
            encodedIterators.append(txidString);
            encodedIterators.append("=");
            encodedIterators.append(new String(hex.encode(iterators)));
          }
         
          return ("" + flushID + encodedIterators).getBytes();
        }
      });
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

      long compactID = Long.parseLong(tokens[0]);
     
      CompactionIterators iters = new CompactionIterators();

      if (tokens.length > 1) {
        Hex hex = new Hex();
        ByteArrayInputStream bais = new ByteArrayInputStream(hex.decode(tokens[1].split("=")[1].getBytes()));
        DataInputStream dis = new DataInputStream(bais);
       
        try {
          iters.readFields(dis);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

      long compactID = Long.parseLong(tokens[0]);

      CompactionIterators iters = new CompactionIterators();

      if (tokens.length > 1) {
        Hex hex = new Hex();
        ByteArrayInputStream bais = new ByteArrayInputStream(hex.decode(tokens[1].split("=")[1].getBytes(Constants.UTF8)));
        DataInputStream dis = new DataInputStream(bais);

        try {
          iters.readFields(dis);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.commons.codec.binary.Hex

     * @return an instance of {@link ResourceChecksumSourceImpl} that uses MD5 and Hex encoding.
     * @since 3.0.3
     */
    protected ResourceChecksumSource createResourceChecksumSource()
    {
        return new ResourceChecksumSourceImpl("MD5", new Hex());
    }
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.