Skip to content

huhr/Go_AES_ECB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

golang AES ECB模式加解密

AES的ECB模式被认为是不安全的,所以golang没有提供官方函数,这里使用golang库中的块加解密算法,实现了 AES的ECB模式加密和解密算法,以及PKCS7Pad补全算法

import (
	"huhr/security"
)

func main() {
	key := "thisiskeyandlen>16"
	//加密
	ciphertext := encrypt(PKCS7Pad([]byte("asdasdasdasdasd")), key)
	//解密
	plaintext := string(PKCS7UPad([]byte(decrypt(ciphertext, key))))
}

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages