ige

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataTooSmall     = errors.New("AES256IGE: data too small")
	ErrDataNotDivisible = errors.New("AES256IGE: data not divisible by block size")
	ErrKeySize          = errors.New("AES256IGE: invalid key size: must be 256 bits")
	ErrMsgKeySize       = errors.New("AES256IGE: invalid msg_key size: must be 16 bytes")
)

Functions

func AlgoKey

func AlgoKey(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte

func BigExp

func BigExp(x, y, m *big.Int) *big.Int

func BytesToBig

func BytesToBig(b []byte) *big.Int

func BytesXor

func BytesXor(a, b []byte) []byte

func Decrypt

func Decrypt(msg, authKey, checkData []byte) ([]byte, error)

func DecryptAES

func DecryptAES(data []byte, key string) ([]byte, error)

func DecryptMessageMTProto added in v1.7.0

func DecryptMessageMTProto(key []byte, msgKey []byte, encrypted []byte, isOriginator bool) (plaintext []byte, err error)

DecryptMessageMTProto2 decrypts a message using MTProto 2.0 encryption for secret chats x = 0 for originator, x = 8 for responder (same as encryption)

func DecryptMessageWithTempKeys

func DecryptMessageWithTempKeys(msg []byte, nonceSecond, nonceServer *big.Int) ([]byte, error)

DecryptMessageWithTempKeys decrypts a message using temporary keys obtained during the Diffie-Hellman key exchange.

func Encrypt

func Encrypt(msg, authKey []byte) (out, msgKey []byte, _ error)

func EncryptAES

func EncryptAES(data []byte, key string) ([]byte, error)

func EncryptMessageMTProto added in v1.7.0

func EncryptMessageMTProto(key []byte, plaintext []byte, isOriginator bool) (msgKey []byte, encrypted []byte, err error)

EncryptMessageMTProto encrypts a message using MTProto 2.0 encryption for secret chats x = 0 for originator, x = 8 for responder

func EncryptMessageWithTempKeys

func EncryptMessageWithTempKeys(msg []byte, nonceSecond, nonceServer *big.Int) ([]byte, error)

EncryptMessageWithTempKeys encrypts a message using temporary keys obtained during the Diffie-Hellman key exchange.

func EncryptV1 added in v1.6.9

func EncryptV1(plaintext, authKey []byte) (out, msgKey []byte, _ error)

EncryptV1 encryptV1.

func MessageKey

func MessageKey(authKey, msgPadded []byte, decode bool) []byte

func Pad256

func Pad256(b []byte) []byte

func PasswordHash2

func PasswordHash2(password, salt1, salt2 []byte) []byte

func RandomBytes

func RandomBytes(size int) []byte

Types

type AesBlock

type AesBlock [aes.BlockSize]byte

type AesIgeBlock

type AesIgeBlock [48]byte

type AesKV

type AesKV [32]byte

type Cipher

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

func NewCipher

func NewCipher(key, iv []byte) (*Cipher, error)

NewCipher

func (*Cipher) DoAES256IGEdecrypt added in v1.7.0

func (c *Cipher) DoAES256IGEdecrypt(in, out []byte) error

func (*Cipher) DoAES256IGEencrypt added in v1.7.0

func (c *Cipher) DoAES256IGEencrypt(in, out []byte) error

type ModPow

type ModPow struct {
	Salt1 []byte
	Salt2 []byte
	G     int32
	P     []byte
}

type SrpAnswer

type SrpAnswer struct {
	GA []byte
	M1 []byte
}

func GetInputCheckPassword

func GetInputCheckPassword(password string, srpB []byte, mp *ModPow, random []byte) (*SrpAnswer, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL