hookFunctions/lock.js
function lockCrc(inputStr){

		res = 0xff;
		inputHex = new Buffer(inputStr,'hex');

		//start from the second byte 
		for (i = 1; i<= inputHex.length; i++) {
			res = res ^ inputHex[i];
		}
		//add padding
		reshex = (res+0x100).toString(16).substr(-2);
//		console.log(reshex);

		return(inputStr+reshex);
}
function lockCrc(inputStr){

		res = 0xff;
		inputHex = new Buffer(inputStr,'hex');

		//start from the second byte 
		for (i = 1; i<= inputHex.length; i++) {
			res = res ^ inputHex[i];
		}
		//add padding
		reshex = (res+0x100).toString(16).substr(-2);
//		console.log(reshex);

		return(inputStr+reshex);
}
function lockCrc ( inputStr ) { res = 0xff ; inputHex = new Buffer ( inputStr , 'hex' ) ; //start from the second byte  for ( i = 1 ; i <= inputHex . length ; i ++ ) { res = res ^ inputHex [ i ] ; } //add padding reshex = ( res + 0x100 ) . toString ( 16 ) . substr ( - 2 ) ; //		console.log(reshex); return ( inputStr + reshex ) ; }
returns string with calculated CRC attached
returns string with calculated CRC attached