Package org.rabinfingerprint.handprint

Examples of org.rabinfingerprint.handprint.Handprint


    List<Long> thumbsA = new ArrayList<Long>(thumbMapA.keySet());

    // print intersection
    for (Long thumb : thumbsA) {
      if (thumbMapB.containsKey(thumb)) {
        Handprint matchA = thumbMapA.get(thumb);
        Handprint matchB = thumbMapB.get(thumb);

        // found exact match
        handsA.remove(matchA);
        handsB.remove(matchB);
View Full Code Here


    // print intersection
    List<Long> fingersA = new ArrayList<Long>(handMapA.keySet());
    for (Long finger : fingersA) {
      if (handMapB.containsKey(finger)) {
        Handprint matchA = handMapA.get(finger);
        Handprint matchB = handMapB.get(finger);

        // found partial match
        handsA.remove(matchA);
        handsB.remove(matchB);
View Full Code Here

    System.out.println(String.format("%X", rabin.getFingerprintLong()));
  }

  public void handprintStdin(Polynomial p) throws IOException {
    HandPrintFactory factory = Handprints.newFactory(p);
    Handprint hand = factory.newHandprint(System.in);
    for (Long finger : hand.getHandFingers().keySet()) {
      System.out.println(String.format("%X", finger));
    }
  }
View Full Code Here

  public void handprintFiles(List<String> paths, Polynomial p) throws IOException {
    HandPrintFactory factory = Handprints.newFactory(p);
    for (String path : paths) {
      File file = new File(path);
      if (file.exists()) {
        Handprint hand = factory.newHandprint(new FileInputStream(file));
        for (Long finger : hand.getHandFingers().keySet()) {
          System.out.println(String.format("%X", finger));
        }
        System.out.flush();
      } else {
        System.err.print(String.format("Could not find file %s", path));
View Full Code Here

  public void testChunkingFiles() throws IOException {
    Polynomial p = Polynomial.createIrreducible(53);
   
    List<InputStream> sims = TestDataGenerator.getSimilarRandomBytes(4);
    HandPrintFactory factory = Handprints.newFactory(p);
    Handprint hand1 = factory.newHandprint(sims.get(0));
    Handprint hand2 = factory.newHandprint(sims.get(1));
    Handprint hand3 = factory.newHandprint(sims.get(2));
    Handprint hand4 = factory.newHandprint(sims.get(3));

    assertTrue(Math.abs(0.70 - hand1.getSimilarity(hand2)) < 0.05);
    assertTrue(Math.abs(0.70 - hand1.getSimilarity(hand3)) < 0.05);
    assertTrue(Math.abs(0.70 - hand1.getSimilarity(hand4)) < 0.05);
   
    List<InputStream> diffs = TestDataGenerator.getDifferentRandomBytes(3);
    Handprint hand5 = factory.newHandprint(diffs.get(0));
    Handprint hand6 = factory.newHandprint(diffs.get(1));
    Handprint hand7 = factory.newHandprint(diffs.get(2));

    assertTrue(Math.abs(0.00 - hand1.getSimilarity(hand5)) < 0.05);
    assertTrue(Math.abs(0.00 - hand1.getSimilarity(hand6)) < 0.05);
    assertTrue(Math.abs(0.00 - hand1.getSimilarity(hand7)) < 0.05);
  }
View Full Code Here

TOP

Related Classes of org.rabinfingerprint.handprint.Handprint

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.