// Path: mobile/blackberry/src/org/bouncycastle/crypto/util/Pack.java
// public abstract class Pack
// {
//     public static int bigEndianToInt(byte[] bs, int off)
//     {
//         int n = bs[  off] << 24;
//         n |= (bs[++off] & 0xff) << 16;
//         n |= (bs[++off] & 0xff) << 8;
//         n |= (bs[++off] & 0xff);
//         return n;
//     }
// 
//     public static void intToBigEndian(int n, byte[] bs, int off)
//     {
//         bs[  off] = (byte)(n >>> 24);
//         bs[++off] = (byte)(n >>> 16);
//         bs[++off] = (byte)(n >>>  8);
//         bs[++off] = (byte)(n       );
//     }
// 
//     public static long bigEndianToLong(byte[] bs, int off)
//     {
//         int hi = bigEndianToInt(bs, off);
//         int lo = bigEndianToInt(bs, off + 4);
//         return ((long)(hi & 0xffffffffL) << 32) | (long)(lo & 0xffffffffL);
//     }
// 
//     public static void longToBigEndian(long n, byte[] bs, int off)
//     {
//         intToBigEndian((int)(n >>> 32), bs, off);
//         intToBigEndian((int)(n & 0xffffffffL), bs, off + 4);
//     }
// }


import org.bouncycastle.crypto.util.Pack;
        int n = in[  inOff] << 24;
        n |= (in[++inOff] & 0xff) << 16;
        n |= (in[++inOff] & 0xff) << 8;
        n |= (in[++inOff] & 0xff);
        X[xOff] = n;

        if (++xOff == 16)
        {
            processBlock();
        }        
    }

    protected void processLength(
        long    bitLength)
    {
        if (xOff > 14)
        {
            processBlock();
        }

        X[14] = (int)(bitLength >>> 32);
        X[15] = (int)(bitLength & 0xffffffff);
    }

    public int doFinal(
        byte[]  out,
        int     outOff)
    {
        finish();

// Path: mobile/blackberry/src/org/bouncycastle/crypto/util/Pack.java
// public abstract class Pack
// {
//     public static int bigEndianToInt(byte[] bs, int off)
//     {
//         int n = bs[  off] << 24;
//         n |= (bs[++off] & 0xff) << 16;
//         n |= (bs[++off] & 0xff) << 8;
//         n |= (bs[++off] & 0xff);
//         return n;
//     }
// 
//     public static void intToBigEndian(int n, byte[] bs, int off)
//     {
//         bs[  off] = (byte)(n >>> 24);
//         bs[++off] = (byte)(n >>> 16);
//         bs[++off] = (byte)(n >>>  8);
//         bs[++off] = (byte)(n       );
//     }
// 
//     public static long bigEndianToLong(byte[] bs, int off)
//     {
//         int hi = bigEndianToInt(bs, off);
//         int lo = bigEndianToInt(bs, off + 4);
//         return ((long)(hi & 0xffffffffL) << 32) | (long)(lo & 0xffffffffL);
//     }
// 
//     public static void longToBigEndian(long n, byte[] bs, int off)
//     {
//         intToBigEndian((int)(n >>> 32), bs, off);
//         intToBigEndian((int)(n & 0xffffffffL), bs, off + 4);
//     }
// }


// Path: mobile/blackberry/src/org/bouncycastle/crypto/digests/SHA1Digest.java
import org.bouncycastle.crypto.util.Pack;

        int n = in[  inOff] << 24;
        n |= (in[++inOff] & 0xff) << 16;
        n |= (in[++inOff] & 0xff) << 8;
        n |= (in[++inOff] & 0xff);
        X[xOff] = n;

        if (++xOff == 16)
        {
            processBlock();
        }        
    }

    protected void processLength(
        long    bitLength)
    {
        if (xOff > 14)
        {
            processBlock();
        }

        X[14] = (int)(bitLength >>> 32);
        X[15] = (int)(bitLength & 0xffffffff);
    }

    public int doFinal(
        byte[]  out,
        int     outOff)
    {
        finish();

        Pack.intToBigEndian(H1, out, outOff);