lib/index.js
function decrypt (input, firstKey = 0xAB) {
  const buf = Buffer.from(input);
  let key = firstKey;
  let nextKey;
  for (let i = 0; i < buf.length; i++) {
    nextKey = buf[i];
    buf[i] = buf[i] ^ key;
    key = nextKey;
  }
  return buf;
}
function decrypt (input, firstKey = 0xAB) {
  const buf = Buffer.from(input);
  let key = firstKey;
  let nextKey;
  for (let i = 0; i < buf.length; i++) {
    nextKey = buf[i];
    buf[i] = buf[i] ^ key;
    key = nextKey;
  }
  return buf;
}
function decrypt ( input , firstKey = 0xAB ) { const buf = Buffer . from ( input ) ; let key = firstKey ; let nextKey ; for ( let i = 0 ; i < buf . length ; i ++ ) { nextKey = buf [ i ] ; buf [ i ] = buf [ i ] ^ key ; key = nextKey ; } return buf ; }
Decrypts input where each byte is XOR'd with the previous encrypted byte.
@alias  module:tplink-smarthome-crypto.decrypt
@param  {Buffer} input           encrypted Buffer
@param  {number} [firstKey=0xAB]
@return {Buffer}                 decrypted buffer
Decrypts input where each byte is XOR d with the previous encrypted byte .