// GO code package main import ( "fmt" "encoding/hex" "encoding/base64" "crypto/hmac" "crypto/sha256" ) func main() { datestring := "08 Apr 2015 21:37:33 GMT" appid := "d6468df6c1e8419fb5ec50f62be9a28b" appkey:= "15c7a6e1a5bd73500db29dffd0e19b6c6228b044c64348a6f5d6d470c54fc208" path := "/xxxxxxxxxxxx/xxxxxxx/api/v1/users/xxxxx/factors" step1 := "GET\\n"+datestring+"\\n"+appid+"\\n"+path fmt.Printf("%s\n",step1) step4 := "ApplicationID:" + makeHmac( step1, appkey ) fmt.Printf("%s\n",step4) step6 := "Basic :" + base64.StdEncoding.EncodeToString([]byte(step4)) fmt.Printf("%s\n", step6) } func makeHmac(data string, key string) string { byteKey, _ := hex.DecodeString(key) byteData := []byte(data) sig := hmac.New(sha256.New, byteKey) sig.Write([]byte(byteData)) return base64.StdEncoding.EncodeToString(sig.Sum(nil)) }