Programmer Reference : Cryptography : Multiprecision Integer Arithmetics
Multiprecision Integer Arithmetics
Module Implementation: OpenSSLCryptoInterfaceBN
This module is primarily a support module providing arithmetic operation on integers of arbitrary size and was designed for use in public key cryptography.
Big Number
OSSslBigNumber
Implements a number that can be arbitrarily large and has some arithmetic operations that can be performed. On the class side are some useful APIs for random number generation. It also has conversion functions to convert to/from a Smalltalk Integer.
Class methods: Creation
createNew
Create a new BIGNUM instance
Answers:
<OSSslBigNumber> - new instance
<OpenSSLError> - error object
 
createNewFromAsn1Integer: anAsn1Integer
Create a new BIGNUM instance from anAsn1Integer
Arguments:
anAsn1Integer - <OSSslAsn1Integer>
Answers:
<OSSslBigNumber> - new instance
<OpenSSLError> - error object
 
createNewFromInteger: anInteger
Create a new BIGNUM instance from anInteger <Integer>
anInteger is not bounded by any size, BIGNUM can represent arbitrarily large integers like Smalltalk
Arguments:
anInteger - <Integer>
Answers:
<OSSslBigNumber> - new instance
<OpenSSLError> - error object
 
Instance methods: API
clear
Destroy sensitive data such as keys when they are no longer needed. It erases the memory used by a and sets it to the value 0.
 
negative
Answer true if the receiver is negative, false otherwise.
Answers:
<Boolean>
 
negative: aBoolean
Set the number to be negative if aBoolean is true, otherwise make it positive.
Answers:
<Boolean> - new instance
 
numberOfBits
Answer the number of bits used to store the number's internal representation.
Answers:
<Integer> - number of bits
 
numberOfBytes
Answer the number of bytes used to store the number's internal representation.
Answers:
<Integer> - number of bytes
 
swap: aBigNumber
Swap the values associated with myself and aBigNumber.
Arguments:
aBigNumber - <OSSslBigNumber>
 
Instance methods: Comparison
compare: aBigNum
Answer the comparison value (semantics described in OSSslStructure>>compare:)
Answers:
<Integer>
 
ucompare: aBigNum
Answer the UNSIGNED comparison value (semantics described in OSSslStructure>>compare:.)
Answers:
<Integer>
 
Instance methods: Conversion
asInteger
Answer a Smalltalk Integer that represents the value of the BIGNUM
Answers:
<Integer>
 
asOpenSSLAsn1Integer
Converts this ASN1_INTEGER into a BIGNUM.
Answers:
< OSSslBigNumber>
 
asOpenSSLBigNumber
Answer myself as a new object reference.
Answers:
<OSSslBigNumber>
 
asString
Converts this BIGNUM into a Smalltalk String.
Answers:
<String>
 
Instance methods: Duplication
duplicate
Answers a managed duplicate of this BIGNUM
Answers:
<OSSslBigNumber> - new duplicate instance
 
Extensions
Integer
asOpenSSLBigNumber
Answer a new OpenSSL BIGNUM with the value of this Integer
Answers:
<OSSslBigNumber>
 
Last modified date: 12/02/2016