Socket
Book a DemoInstallSign in
Socket

github.com/huhr/security

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/huhr/security

v0.0.0-20150512073151-d6086d710eee
Source
Go
Version published
Created
Source

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))))
}

FAQs

Package last updated on 12 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.