Tutorial of creating new math wrappers for Crypt_RSA package. Math wrapper class must have the following name: Crypt_RSA_Math_{wrapper_name} where {wrapper_name} - name of math wrapper. Function getWrapperName() must return this name (see description of this function below). This class must be placed into Crypt/RSA/Math/{math_wrapper}.php file Math wrapper class must provide interface with following functions: bin2int($str) - transforms binary representation of large integer into its native form int2bin($num) - transforms large integer from native form into binary representation powmod($a, $b, $mod) - calculates ($a ^ $b) % $mod mul($a, $b) - calculates $a * $b mod($a, $b) - calculates $a % $b cmpAbs($a, $b) - compares abs($a) with abs($b) isPrime($num) - returns true if $num is strong pseudoprime getPrime($bits_cnt, $rnd_generator) - returns prime with length $bits_cnt dec($num) - calculates $num - 1 isOne($num) - returns true, if $num is one GCD($a, $b) - calculates greatest common divider of $an and $b invmod($num, $mod) - calculates number $num1 such as ($num1 * $num) % $mod = 1 bitOr($a, $b, $start_bit) - calculates bitwise ($a or ($b << $start_bit)) subint($num, $start, $bit_len) - returns part of number $num, starting at position $start, with length $len getWrapperName() - returns wrapper's name It also must have public string varibale $errstr, which must be set to empty string by default, or non-empty string with error description on error See an existing implementations of math wrappers in Crypt/RSA/Math directory for more info.