Example usage for org.bouncycastle.crypto.util Pack intToBigEndian

List of usage examples for org.bouncycastle.crypto.util Pack intToBigEndian

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.util Pack intToBigEndian.

Prototype

public static void intToBigEndian(int[] ns, byte[] bs, int off) 

Source Link

Usage

From source file:com.licel.jcardsim.crypto.MessageDigestImpl.java

License:Apache License

void getIntermediateDigest(byte[] intermediateDigest, int off) {
    // get hash state - BouncyCastle specific
    try {//from w  w w  .j a va 2  s . c  o m
        for (byte i = 0; i < componentCount; i++) {
            // some reflection work
            Field h = digestClass.getDeclaredField("H" + (i + componentStartIdx));
            h.setAccessible(true);
            if (componentSize == 4) {
                Pack.intToBigEndian(h.getInt(engine), intermediateDigest, off + i * componentSize);
            } else {
                Pack.longToBigEndian(h.getLong(engine), intermediateDigest, off + i * componentSize);
            }
        }
    } catch (Exception e) {
        CryptoException.throwIt(CryptoException.ILLEGAL_USE);
    }
}