code: function i2osp(x, len){
    const r = new Uint8Array(len);
    r.forEach( (elem, idx) => {
      const y = 0xFF & (x >> (idx*8));
      r[len - idx - 1] = y;
    });
    return r;
  }
docs: I2OSP function
  @param {Number} x - Number to be encoded to byte array in network byte order.
  @param {Number} len - Length of byte array
  @return {Uint8Array} - Encoded number.