src/sha_dev.js
function bytes2packed(str, existingPacked, existingPackedLen, bigEndianMod)
	{
		var packed, codePnt, i, existingByteLen, intOffset,
			byteOffset, shiftModifier;

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

		for (i = 0; i < str.length; i += 1)
		{
			codePnt = str.charCodeAt(i);

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

		return {"value" : packed, "binLen" : str.length * 8 + existingPackedLen};
	}
function bytes2packed(str, existingPacked, existingPackedLen, bigEndianMod)
	{
		var packed, codePnt, i, existingByteLen, intOffset,
			byteOffset, shiftModifier;

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

		for (i = 0; i < str.length; i += 1)
		{
			codePnt = str.charCodeAt(i);

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

		return {"value" : packed, "binLen" : str.length * 8 + existingPackedLen};
	}
function bytes2packed ( str , existingPacked , existingPackedLen , bigEndianMod ) { var packed , codePnt , i , existingByteLen , intOffset , byteOffset , shiftModifier ; packed = existingPacked || [ 0 ] ; existingPackedLen = existingPackedLen || 0 ; existingByteLen = existingPackedLen >>> 3 ; shiftModifier = ( bigEndianMod === - 1 ) ? 3 : 0 ; for ( i = 0 ; i < str . length ; i += 1 ) { codePnt = str . charCodeAt ( i ) ; byteOffset = i + existingByteLen ; intOffset = byteOffset >>> 2 ; if ( packed . length <= intOffset ) { packed . push ( 0 ) ; } packed [ intOffset ] |= codePnt << ( 8 * ( shiftModifier + bigEndianMod * ( byteOffset % 4 ) ) ) ; } return { "value" : packed , "binLen" : str . length * 8 + existingPackedLen } ; }
Convert a string of raw bytes to an array of big-endian words

@private
@param {string} str String of raw bytes 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 a string of raw bytes to an array of big - endian words