Documentation ¶
Index ¶
- func Xor(x []byte, y []byte)
- type AES
- func (a *AES) DecryptCBC(in []byte, iv []byte, unpad utils.UnpaddingFunc) []byte
- func (a *AES) DecryptCFB(in []byte, iv []byte, s int) []byte
- func (a *AES) DecryptCTR(in []byte, iv []byte) []byte
- func (a *AES) DecryptECB(in []byte, unpad utils.UnpaddingFunc) []byte
- func (a *AES) DecryptGCM(in []byte, iv []byte, auth []byte, tag []byte) []byte
- func (a *AES) DecryptOFB(in []byte, iv []byte) []byte
- func (a *AES) EncryptCBC(in []byte, iv []byte, pad utils.PaddingFunc) []byte
- func (a *AES) EncryptCFB(in []byte, iv []byte, s int) []byte
- func (a *AES) EncryptCTR(in []byte, iv []byte) []byte
- func (a *AES) EncryptECB(in []byte, pad utils.PaddingFunc) []byte
- func (a *AES) EncryptGCM(in []byte, iv []byte, auth []byte, tagLen int) ([]byte, []byte)
- func (a *AES) EncryptGCTR(in []byte, ICB []byte) []byte
- func (a *AES) EncryptOFB(in []byte, iv []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AES ¶
type AES struct {
// contains filtered or unexported fields
}
func NewAES ¶
NewAES returns a pointer of type AES and an error.
key: The following algorithms will be used based on the size of the key:
16 bytes = AES-128
24 bytes = AES-192
32 bytes = AES-256
func (*AES) DecryptCBC ¶
DecryptCBC returns the plaintext of CBC-mode decryption. The iv must be 128bit.
func (*AES) DecryptCFB ¶
DecryptCFB decrypts every s bytes of ciphertext, with s at least 1 and no more than 128. The iv must be 128bit.
func (*AES) DecryptCTR ¶
DecryptCTR returns the plaintext of CTR-mode decryption. The iv must be 128bit. It is exactly the same with EncryptCTR.
func (*AES) DecryptECB ¶
func (a *AES) DecryptECB(in []byte, unpad utils.UnpaddingFunc) []byte
DecryptECB returns the plaintext of ECB-mode decryption.
func (*AES) DecryptGCM ¶
DecryptGCM returns the plaintext of GCM-mode decryption or a nil if authentication failed.
func (*AES) DecryptOFB ¶
DecryptOFB returns the plaintext of OFB-mode decryption. The iv must be 128bit.
func (*AES) EncryptCBC ¶
EncryptCBC returns the cipher of CBC-mode encryption. The iv must be 128bit.
func (*AES) EncryptCFB ¶
EncryptCFB encrypts every s bytes of plaintext, with s at least 1 and no more than 128. The iv must be 128bit.
func (*AES) EncryptCTR ¶
EncryptCTR returns the ciphertext of CTR-mode encryption. The iv must be 128bit.
func (*AES) EncryptECB ¶
func (a *AES) EncryptECB(in []byte, pad utils.PaddingFunc) []byte
EncryptECB returns the cipher of ECB-mode encryption.
func (*AES) EncryptGCM ¶
EncryptGCM returns the ciphertext of GCM-mode encryption and the tag.
func (*AES) EncryptGCTR ¶
EncryptGCTR encrypts plaintext in with initial counter block ICB.