package machineid

import (
	"crypto/md5"
	"encoding/hex"
	"strings"
)

func ID() (identified string, err error) {
	if identified, err = getMachineID(); err == nil {
		identified = strings.TrimSpace(strings.Trim(identified, "\n"))
	}
	return
}

func Code() (identified string, err error) {
	if identified, err = ID(); err == nil {
		encoder := md5.New()
		encoder.Write([]byte(identified))
		identified = hex.EncodeToString(encoder.Sum(nil))
	}
	return
}
