Example usage for org.bouncycastle.crypto ExtendedDigest update

List of usage examples for org.bouncycastle.crypto ExtendedDigest update

Introduction

In this page you can find the example usage for org.bouncycastle.crypto ExtendedDigest update.

Prototype

public void update(byte[] in, int inOff, int len);

Source Link

Document

update the message digest with a block of bytes.

Usage

From source file:no.digipost.api.useragreements.client.filters.request.RequestContentHashFilter.java

License:Apache License

public void settContentHashHeader(final byte[] data, final HttpRequest httpRequest) {
    ExtendedDigest instance = digestSupplier.get();
    byte[] result = new byte[instance.getDigestSize()];
    instance.update(data, 0, data.length);
    instance.doFinal(result, 0);/*from w  w w . j  a v  a2  s .  c o  m*/
    String hash = base64Encoder.encodeToString(result);
    httpRequest.setHeader(header, hash);
    log.debug(RequestContentHashFilter.class.getSimpleName() + " satt headeren " + header + "=" + hash);
}