go语言实现AES加密的方法
本文实例讲述了go语言实现AES加密的方法。分享给大家供大家参考。具体实现方法如下:
代码如下:
package main import ( "fmt" "crypto/aes" "strings" ) func main(){ rb:=[]byte {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6}; b:=make([]byte,16); strings.NewReader("1234567890123456").Read(b); // b=b[0:16]; fmt.Print("b:",b); cip,_:= aes.NewCipher(b); fmt.Print("cip:",cip,"err:"); out:=make([]byte,len(rb)); cip.Encrypt (rb, out); }
希望本文所述对大家的Go语言程序设计有所帮助。
相关推荐
tengyuan 2020-05-30
visionzheng 2020-05-04
LowisLucifer 2020-04-30
dbhllnr 2020-04-26
wordmhg 2020-03-27
wbingyang 2020-02-14
CloudXli 2020-01-12
ahnuzfm 2019-12-24
JF0 2019-12-09
hgzhang 2019-10-22
数据与算法之美 2015-03-09
frankwtq 2012-02-02
guohewei 2019-03-28
HerryDong 2018-05-14
zhuyonge 2016-05-19
走在IT的路上 2013-11-07
风吹夏天 2012-08-28