代码拉取完成,页面将自动刷新
package algorithm
import "crypto/cipher"
type ecb struct {
b cipher.Block
blockSize int
}
func newECB(b cipher.Block) *ecb {
return &ecb{
b: b,
blockSize: b.BlockSize(),
}
}
type ecbEncrypt ecb
// NewECBEncrypt returns a BlockMode which encrypts in electronic code book
// mode, using the given Block.
func NewECBEncrypt(b cipher.Block) cipher.BlockMode {
return (*ecbEncrypt)(newECB(b))
}
func (e *ecbEncrypt) BlockSize() int {
return e.blockSize
}
func (e *ecbEncrypt) CryptBlocks(dst, src []byte) {
if len(src)%e.blockSize != 0 {
panic("cipher/ecb: input not full blocks")
}
if len(dst) < len(src) {
panic("cipher/ecb: output smaller than input")
}
for len(src) > 0 {
e.b.Encrypt(dst, src[:e.blockSize])
src = src[e.blockSize:]
dst = dst[e.blockSize:]
}
}
type ecbDecrypter ecb
// NewECBDecrypter returns a BlockMode which decrypts in electronic code book
// mode, using the given Block.
func NewECBDecrypter(b cipher.Block) cipher.BlockMode {
return (*ecbDecrypter)(newECB(b))
}
func (e *ecbDecrypter) BlockSize() int {
return e.blockSize
}
func (e *ecbDecrypter) CryptBlocks(dst, src []byte) {
if len(src)%e.blockSize != 0 {
panic("cipher/ecb: input not full blocks")
}
if len(dst) < len(src) {
panic("cipher/ecb: output smaller than input")
}
for len(src) > 0 {
e.b.Decrypt(dst, src[:e.blockSize])
src = src[e.blockSize:]
dst = dst[e.blockSize:]
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。