#!/bin/bash

function hash_mac {
mac="$1"
key="8544e3b47eca58f9583043f8"
sub="\x"

#convert mac to hex
hexmac="\x${mac//:/$sub}"

#create hash
code=$(printf "$hexmac" | openssl dgst -sha1 -mac HMAC -macopt hexkey:"$key")

#DEBUG
echo "$mac"
echo "$hexmac"
echo "$code"
echo "${code:0:4}-${code:4:4}-${code:8:4}-${code:12:4}-${code:16:4}-${code:20:4}"
}

#hex output with input
hash_mac "$1"