Documentation ¶
Overview ¶
Package algoutil contain some scaffold algo
Index ¶
- func AccessControl(h http.Handler) http.Handler
- func CallSite() interface{}
- func ConcatWithURLEncode(params map[string]string) *bytes.Buffer
- func CopyDir(dst string, src string) error
- func CopyFile(dst, src string) error
- func FileExists(path string) bool
- func GenRSAKey() (privateKey, publicKey string, err error)
- func HTTPGet(url string) (string, error)
- func LoadPrivateKey(privKeyPath string) (*rsa.PrivateKey, error)
- func MD5(plain []byte) []byte
- func MD5String(plain string) string
- func MakeDirIfNeed(dir string, mode os.FileMode) error
- func OptionControl(h http.Handler) http.Handler
- func ParamsToStruct(params string, v interface{}) error
- func ParseParams(params string) map[string]string
- func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)
- func PasswordHash(pwd string) (hash, salt string)
- func RSADecrypt(cipher []byte, privKey string) ([]byte, error)
- func RSAEncrypt(plain []byte, pubKey string) ([]byte, error)
- func RandStr(strlen int) string
- func RetriveInt64OrDefault(s string, d int64) int64
- func RetriveIntOrDefault(s string, d int) int
- func RunCmd(cmdName string, workingDir string, args ...string) (string, error)
- func Sign(plain []byte, privKey string) (string, error)
- func SortAndConcat(params map[string]string, extras ...bool) []byte
- func SortParams(m map[string]string) string
- func TimeRange(start, end int64) (int64, int64)
- func Unused(args ...interface{})
- func Utf8ToGBK(utf8str string) string
- func Verify(pubKey string, data []byte, sign string) error
- func VerifyPassword(pwd, salt, hash string) bool
- func VerifyRSAWithMD5(pubKey string, data []byte, sign string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
func LoadPrivateKey ¶
func LoadPrivateKey(privKeyPath string) (*rsa.PrivateKey, error)
func ParamsToStruct ¶
TODO: WARNING!!!!!!! All struct field must be string type
func ParseParams ¶
func ParsePrivateKey ¶
func ParsePrivateKey(data []byte) (*rsa.PrivateKey, error)
func PasswordHash ¶
PasswordHash accept password and generate with uuid as salt FORMAT: sha1.Sum(pwd + salt + sha1.Sum(salt + pwd + salt) + salt + pwd)
func RSADecrypt ¶
RsaDecrypt decrypt data by rsa
func RSAEncrypt ¶
RSAEncrypt encrypt data by rsa
func RetriveInt64OrDefault ¶
func RetriveIntOrDefault ¶
func SortAndConcat ¶
SortAndConcat sort the map by key in ASCII order, and concat it in form of "k1=v1&k2=v2"
func SortParams ¶
func VerifyPassword ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.