add mac calculation & convert function.