github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/crypto/cipher/sample/mn.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  	"fmt"
     6  	"github.com/sixexorg/magnetic-ring/crypto/cipher"
     7  )
     8  
     9  func main() {
    10  	text := flag.String("text", "", "text you want encript")
    11  	pasw := flag.String("pasw", "", "encript password")
    12  	flag.Parse()
    13  	if *text=="" || *pasw=="" {
    14  		fmt.Printf("please give the text and pasw")
    15  		return
    16  	}
    17  
    18  	fmt.Printf("listenAddr=%s\n",*text)
    19  	cph := cipher.NewCipher()
    20  	src := []byte(*text)
    21  	password := []byte(*pasw)
    22  	result,err := cph.Encrypt(src,password)
    23  
    24  	if err != nil {
    25  		fmt.Println("err=",err)
    26  		return
    27  	}
    28  
    29  
    30  	fmt.Printf("encrypt success,result=%s\n",result)
    31  
    32  
    33  	//decstr,err := cph.Decrypt(result,password)
    34  	//if err != nil {
    35  	//	fmt.Println("err=",err)
    36  	//	return
    37  	//}
    38  	//
    39  	//fmt.Printf("src=%s\n",decstr)
    40  
    41  }