Movatterモバイル変換


[0]ホーム

URL:


aes

packagestandard library
go1.25.5Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:12Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Index

Constants

View Source
const BlockSize = 16

BlockSize is the AES block size in bytes.

Variables

This section is empty.

Functions

funcEncryptBlockInternal

func EncryptBlockInternal(c *Block, dst, src []byte)

EncryptBlockInternal applies the AES encryption function to one block.

It is an internal function meant only for the gcm package.

funcEncryptionKeySchedule

func EncryptionKeySchedule(c *Block) []uint32

EncryptionKeySchedule is used from the GCM implementation to access theprecomputed AES key schedule, to pass to the assembly implementation.

funcRoundToBlock

func RoundToBlock(c *CTR)

RoundToBlock is used by CTR_DRBG, which discards the rightmost unused bits ateach request. It rounds the offset up to the next block boundary.

Types

typeBlock

type Block struct {// contains filtered or unexported fields}

A Block is an instance of AES using a particular key.It is safe for concurrent use.

funcNew

func New(key []byte) (*Block,error)

New creates and returns a new [cipher.Block] implementation.The key argument should be the AES key, either 16, 24, or 32 bytes to selectAES-128, AES-192, or AES-256.

func (*Block)BlockSize

func (c *Block) BlockSize()int

func (*Block)Decrypt

func (c *Block) Decrypt(dst, src []byte)

func (*Block)Encrypt

func (c *Block) Encrypt(dst, src []byte)

typeCBCDecrypter

type CBCDecrypter struct {// contains filtered or unexported fields}

funcNewCBCDecrypter

func NewCBCDecrypter(b *Block, iv [BlockSize]byte) *CBCDecrypter

NewCBCDecrypter returns a [cipher.BlockMode] which decrypts in cipher blockchaining mode, using the given Block.

func (*CBCDecrypter)BlockSize

func (c *CBCDecrypter) BlockSize()int

func (*CBCDecrypter)CryptBlocks

func (c *CBCDecrypter) CryptBlocks(dst, src []byte)

func (*CBCDecrypter)SetIV

func (x *CBCDecrypter) SetIV(iv []byte)

typeCBCEncrypter

type CBCEncrypter struct {// contains filtered or unexported fields}

funcNewCBCEncrypter

func NewCBCEncrypter(b *Block, iv [BlockSize]byte) *CBCEncrypter

NewCBCEncrypter returns a [cipher.BlockMode] which encrypts in cipher blockchaining mode, using the given Block.

func (*CBCEncrypter)BlockSize

func (c *CBCEncrypter) BlockSize()int

func (*CBCEncrypter)CryptBlocks

func (c *CBCEncrypter) CryptBlocks(dst, src []byte)

func (*CBCEncrypter)SetIV

func (x *CBCEncrypter) SetIV(iv []byte)

typeCTR

type CTR struct {// contains filtered or unexported fields}

funcNewCTR

func NewCTR(b *Block, iv []byte) *CTR

func (*CTR)XORKeyStream

func (c *CTR) XORKeyStream(dst, src []byte)

func (*CTR)XORKeyStreamAt

func (c *CTR) XORKeyStreamAt(dst, src []byte, offsetuint64)

XORKeyStreamAt behaves like XORKeyStream but keeps no state, and insteadseeks into the keystream by the given bytes offset from the start (ignoringany XORKetStream calls). This allows for random access into the keystream, upto 16 EiB from the start.

typeKeySizeError

type KeySizeErrorint

func (KeySizeError)Error

func (kKeySizeError) Error()string

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp