/** * Hash the data.getBytes("UTF-8") and returns the first 8 bytes of the hash value. * @param data data over which the hash value is calculated. * @return long represented of the first 8 bytes */ public static long hash(String data) { Args.notNull(data, "data"); byte[] encoded; try { encoded = data.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { encoded = data.getBytes(); } return hash(encoded); }
/** * Hash the data and returns the first 8 bytes of the hash value. * @param data data over which the hash value is calculated. * @return long represented of the first 8 bytes */ public static long hash(byte[] data) { Args.notNull(data, "data"); ConcurrentBagEntry<Digest> md0 = null; for (int i = 0; i < 3; i++) { try { md0 = MDS.borrow(10, TimeUnit.SECONDS); break; } catch (InterruptedException ex) { // CHECKSTYLE:SKIP } } if (md0 == null) { throw new RuntimeOperatorException("could not get idle MessageDigest"); } try { Digest md = md0.value(); md.reset(); md.update(data, 0, data.length); byte[] bytes = new byte[md.getDigestSize()]; md.doFinal(bytes, 0); return bytesToLong(bytes); } finally { MDS.requite(md0); } }
/** * Hash the data and returns the first 8 bytes of the hash value. * @param data data over which the hash value is calculated. * @return long represented of the first 8 bytes */ public static long hash(final byte[] data) { ParamUtil.requireNonNull("data", data); ConcurrentBagEntry<Digest> md0 = null; for (int i = 0; i < 3; i++) { try { md0 = MDS.borrow(10, TimeUnit.SECONDS); break; } catch (InterruptedException ex) { // CHECKSTYLE:SKIP } } if (md0 == null) { throw new RuntimeOperatorException("could not get idle MessageDigest"); } try { Digest md = md0.value(); md.reset(); md.update(data, 0, data.length); byte[] bytes = new byte[md.getDigestSize()]; md.doFinal(bytes, 0); return bytesToLong(bytes); } finally { MDS.requite(md0); } }
/** * Hash the data.getBytes("UTF-8") and returns the first 8 bytes of the hash value. * @param data data over which the hash value is calculated. * @return long represented of the first 8 bytes */ public static long hash(final String data) { ParamUtil.requireNonNull("data", data); byte[] encoded; try { encoded = data.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { encoded = data.getBytes(); } return hash(encoded); }
public static long fpCanonicalizedName(X500Name name) { Args.notNull(name, "name"); String canonicalizedName = canonicalizName(name); byte[] encoded; try { encoded = canonicalizedName.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { encoded = canonicalizedName.getBytes(); } return FpIdCalculator.hash(encoded); }
public static long fpCanonicalizedName(final X500Name name) { ParamUtil.requireNonNull("name", name); String canonicalizedName = canonicalizName(name); byte[] encoded; try { encoded = canonicalizedName.getBytes("UTF-8"); } catch (UnsupportedEncodingException ex) { encoded = canonicalizedName.getBytes(); } return FpIdCalculator.hash(encoded); }
long fpPk = FpIdCalculator.hash(encodedSubjectPublicKey); String subjectText = X509Util.cutText(certificate.getSubject(), maxX500nameLen); long fpSubject = X509Util.fpCanonicalizedName(certificate.getSubjectAsX500Name());
stmt.setLong(idx++, FpIdCalculator.hash(encodedKey)); Extension extension = tbsCert.getExtensions().getExtension(Extension.basicConstraints); boolean ee = true;
stmt.setLong(idx++, FpIdCalculator.hash(encodedKey)); Extension extension = tbsCert.getExtensions().getExtension(Extension.basicConstraints); boolean ee = true;
psCert.setLong(idx++, FpIdCalculator.hash(encodedKey)); Extension extension = tbsCert.getExtensions().getExtension(Extension.basicConstraints);
long fpPublicKey = FpIdCalculator.hash(subjectPublicKeyData);