Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute GO Language Online

package main

import (
    "crypto/hmac"
    "crypto/md5"
	"encoding/hex"
	"strconv"
	"fmt"
	"log"
)

func main() {

    var data [7]string
    data[0]="1.00"
    data[1]="RON"
    data[2]="123"
    data[3]="descriere comanda"
    data[4]="testaccount"
    data[5]="20180716170500"
    data[6]="somerandomstring12345689"
    
    fp_hash:=ephmac("00112233445566778899AABBCCDDEEFF",data)
    
    url:="https://secure.euplatesc.ro/tdsprocess/tranzactd.php?"
    url+="amount="+data[0]
    url+="&curr="+data[1]
    url+="&invoice_id="+data[2]
    url+="&order_desc="+data[3]
    url+="&merch_id="+data[4]
    url+="&timestamp="+data[5]
    url+="&nonce="+data[6]
    url+="&fp_hash="+fp_hash
    fmt.Println(url)
}

func ephmac (key string, data[7] string)(string){
    
    var strf string=""
    for i := 0; i < 7; i++ {
		if len(data[i])==0{
		    strf+="-"
		}else{
		     strf+=strconv.Itoa(len(data[i]))+data[i]
		}
		    
	}

    bin_key, err := hex.DecodeString(key)
    
    if err != nil {
		log.Fatal(err)
	}

    hmacmd5 := hmac.New(md5.New, bin_key)
    hmacmd5.Write([]byte(strf))
    res:=hmacmd5.Sum(nil)
    
    return hex.EncodeToString(res)
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.