src/sha_dev.js
function arraybuffer2packed(arr, existingPacked, existingPackedLen, bigEndianMod)
	{
		var packed, i, existingByteLen, intOffset, byteOffset, shiftModifier, arrView;

		packed = existingPacked || [0];
		existingPackedLen = existingPackedLen || 0;
		existingByteLen = existingPackedLen >>> 3;
		shiftModifier = (bigEndianMod === -1) ? 3 : 0;
		arrView = new Uint8Array(arr);

		for (i = 0; i < arr.byteLength; i += 1)
		{
			byteOffset = i + existingByteLen;
			intOffset = byteOffset >>> 2;
			if (packed.length <= intOffset)
			{
				packed.push(0);
			}
			packed[intOffset] |= arrView[i] << (8 * (shiftModifier + bigEndianMod * (byteOffset % 4)));
		}

		return {"value" : packed, "binLen" : arr.byteLength * 8 + existingPackedLen};
	}
function arraybuffer2packed(arr, existingPacked, existingPackedLen, bigEndianMod)
	{
		var packed, i, existingByteLen, intOffset, byteOffset, shiftModifier, arrView;

		packed = existingPacked || [0];
		existingPackedLen = existingPackedLen || 0;
		existingByteLen = existingPackedLen >>> 3;
		shiftModifier = (bigEndianMod === -1) ? 3 : 0;
		arrView = new Uint8Array(arr);

		for (i = 0; i < arr.byteLength; i += 1)
		{
			byteOffset = i + existingByteLen;
			intOffset = byteOffset >>> 2;
			if (packed.length <= intOffset)
			{
				packed.push(0);
			}
			packed[intOffset] |= arrView[i] << (8 * (shiftModifier + bigEndianMod * (byteOffset % 4)));
		}

		return {"value" : packed, "binLen" : arr.byteLength * 8 + existingPackedLen};
	}
function arraybuffer2packed ( arr , existingPacked , existingPackedLen , bigEndianMod ) { var packed , i , existingByteLen , intOffset , byteOffset , shiftModifier , arrView ; packed = existingPacked || [ 0 ] ; existingPackedLen = existingPackedLen || 0 ; existingByteLen = existingPackedLen >>> 3 ; shiftModifier = ( bigEndianMod === - 1 ) ? 3 : 0 ; arrView = new Uint8Array ( arr ) ; for ( i = 0 ; i < arr . byteLength ; i += 1 ) { byteOffset = i + existingByteLen ; intOffset = byteOffset >>> 2 ; if ( packed . length <= intOffset ) { packed . push ( 0 ) ; } packed [ intOffset ] |= arrView [ i ] << ( 8 * ( shiftModifier + bigEndianMod * ( byteOffset % 4 ) ) ) ; } return { "value" : packed , "binLen" : arr . byteLength * 8 + existingPackedLen } ; }
Convert an ArrayBuffer to an array of big-endian words

@private
@param {ArrayBuffer} arr ArrayBuffer to be converted to binary
representation
@param {Array<number>} existingPacked A packed int array of bytes to
append the results to
@param {number} existingPackedLen The number of bits in the existingPacked
array
@param {number} bigEndianMod Modifier for whether hash function is
big or small endian
@return {{value : Array<number>, binLen : number}} Hash list where
"value" contains the output number array and "binLen" is the binary
length of "value"
Convert an ArrayBuffer to an array of big - endian words