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

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

Introduction

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

Prototype

public static void longToBigEndian(long[] 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 {//w w w  . j a  v a2 s. com
        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);
    }
}