You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
393 B

package tools
import (
"crypto/md5"
"encoding/hex"
)
type Api struct {
Tools string `json:"tools"`
Values []interface{} `json:"values"`
}
func (p *Api) Run() interface{} {
switch p.Tools {
case "MD5":
return p.Md5(p.Values[0].(string))
}
return nil
}
func (p *Api) Md5(data string) string {
m := md5.New()
m.Write([]byte(data))
return hex.EncodeToString(m.Sum(nil))
}