#!/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:9:4} ${code:13:4} ${code:17:4} ${code:21:4} ${code:25:4} ${code:29:4}"
}

#hex output with input
hash_mac "$1"

#Look out for the quotes, they might get changed by different encoding