math

package
v1.6.10 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Copyright (c) 2025 @AmarnathCJD

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRSAencrypt

func DoRSAencrypt(block []byte, key *rsa.PublicKey) []byte

DoRSAencrypt encrypts exactly one message block of size 255 bytes using the given public key. This is a custom algorithm for MTProto. The Telegram documentation does not specify whether this encryption follows OAEP or any other standard padding scheme. Use only for MTProto protocol blocks, not for general-purpose RSA encryption.

func Factorize added in v1.6.1

func Factorize(pq *big.Int) (*big.Int, *big.Int)

func MakeGAB

func MakeGAB(g int32, g_a, dh_prime *big.Int) (b, g_b, g_ab *big.Int)

func SplitPQ

func SplitPQ(pq *big.Int) (p, q *big.Int)

SplitPQ factors a composite number pq into two prime numbers p and q, ensuring p < q. This is used in Diffie-Hellman key exchange, where factoring pq is required for protocol security checks. The function implements Pollard's rho algorithm for integer factorization, which is efficient for numbers with small factors.

func XOR added in v1.6.10

func XOR(dst, src []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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