lib/crypto/hmac-block-transform.js
function getBlockHmac(key, blockIndex, blockLength, blockData) {
    return getHmacKey(key, new Int64(blockIndex)).then(function(blockKey) {
        var blockDataForHash = new Uint8Array(blockData.byteLength + 4 + 8);
        var blockDataForHashView = new DataView(blockDataForHash.buffer);
        blockDataForHash.set(new Uint8Array(blockData), 4 + 8);
        blockDataForHashView.setInt32(0, blockIndex, true);
        blockDataForHashView.setInt32(8, blockLength, true);
        return CryptoEngine.hmacSha256(blockKey, blockDataForHash.buffer);
    });
}
function getBlockHmac(key, blockIndex, blockLength, blockData) {
    return getHmacKey(key, new Int64(blockIndex)).then(function(blockKey) {
        var blockDataForHash = new Uint8Array(blockData.byteLength + 4 + 8);
        var blockDataForHashView = new DataView(blockDataForHash.buffer);
        blockDataForHash.set(new Uint8Array(blockData), 4 + 8);
        blockDataForHashView.setInt32(0, blockIndex, true);
        blockDataForHashView.setInt32(8, blockLength, true);
        return CryptoEngine.hmacSha256(blockKey, blockDataForHash.buffer);
    });
}
function getBlockHmac ( key , blockIndex , blockLength , blockData ) { return getHmacKey ( key , new Int64 ( blockIndex ) ) . then ( function ( blockKey ) { var blockDataForHash = new Uint8Array ( blockData . byteLength + 4 + 8 ) ; var blockDataForHashView = new DataView ( blockDataForHash . buffer ) ; blockDataForHash . set ( new Uint8Array ( blockData ) , 4 + 8 ) ; blockDataForHashView . setInt32 ( 0 , blockIndex , true ) ; blockDataForHashView . setInt32 ( 8 , blockLength , true ) ; return CryptoEngine . hmacSha256 ( blockKey , blockDataForHash . buffer ) ; } ) ; }
Gets block HMAC
@param {ArrayBuffer} key
@param {number} blockIndex
@param {number} blockLength
@param {ArrayBuffer} blockData
@returns {Promise.<ArrayBuffer>}
Gets block HMAC