if ((iv == null) || (payload == null) || (sessionKey == null) || (iv.length != 16)) return null;
int size = Hash.HASH_LENGTH
+ 4 // sizeof(payload)
+ payload.length;
int padding = ElGamalAESEngine.getPaddingSize(size, paddedSize);
<BUG>byte data[] = new byte[size + padding];
Hash h = _context.sha().calculateHash(iv);
int cur = 0;
System.arraycopy(h.getData(), 0, data, cur, Hash.HASH_LENGTH);
cur += Hash.HASH_LENGTH;
</BUG>
DataHelper.toLong(data, cur, 4, payload.length);

if ((iv == null) || (payload == null) || (sessionKey == null) || (iv.length != 16)) return null;
int size = Hash.HASH_LENGTH
+ 4 // sizeof(payload)
+ payload.length;
int padding = ElGamalAESEngine.getPaddingSize(size, paddedSize);
byte data[] = new byte[size + padding];
_context.sha().calculateHash(iv, 0, 16, data, 0);
int cur = Hash.HASH_LENGTH;
DataHelper.toLong(data, cur, 4, payload.length);
