Skip to content

things-labs/aesext

Repository files navigation

aesext

这是一个块加密,固定Key,固定IV,加解密长度一致,不传IV.所以同一白文加密后,密文是一致的.
如需密文传输随机IV,请使用 encrypt 的encrypt的块加密, 同一白文加密后,密文是不一样的

GoDoc Go.Dev reference codecov Action Status Go Report Card Licence Tag

    go get github.com/things-labs/aesext

Import:

    import "github.com/things-labs/aesext"

Example

package main

import (
	"bytes"

	"github.com/things-labs/aesext"
)

func main() {
	key, salt := []byte("iamakey"), []byte("iamasalt")

	bc, err := aesext.New(key, salt)
	if err != nil {
		panic(err)
	}
	want := []byte("iamaplaintext")

	cipherText, err := bc.Encrypt(want)
	if err != nil {
		panic(err)
	}
	got, err := bc.Decrypt(cipherText)
	if err != nil {
		panic(err)
	}

	ok := bytes.Equal(got, want)
	if !ok {
		panic("invalid encrypt and decrypt")
	}
}

License

This project is under MIT License. See the LICENSE file for the full license text.

About

😏 aes extend package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages