|
1 /** |
|
2 @page bigint Big Integer |
|
3 |
|
4 - @ref bigintWhat |
|
5 - @ref bigintHow |
|
6 |
|
7 @section bigintWhat What does the big integer library do? |
|
8 |
|
9 Some types of cryptography require the handling of finite arbitrary length |
|
10 integers. This big integer library attempts to provide support for that |
|
11 requirement. |
|
12 |
|
13 It is capable of representing both negative and positive integers with an |
|
14 absolute value of less than 2<sup>32</sup>^(2<sup>32</sup>). |
|
15 |
|
16 @section bigintHow How do I use the big integer library? |
|
17 |
|
18 There are four categories of exposed APIs: |
|
19 -# Creation of new integers given some other representation (descriptor, TUint, |
|
20 etc). |
|
21 @ref RInteger RInteger::NewL() |
|
22 -# Creation of new integers given some criteria (range, bitcount, prime). |
|
23 @ref RInteger RInteger::NewRandomL(), RInteger::NewPrimeL() |
|
24 -# Exporting of previously created integers to descriptors. |
|
25 @ref TInteger TInteger::BufferLC() |
|
26 -# Querying attributes about the size of a previously created integer. |
|
27 @ref TInteger TInteger::BitCount(), TInteger::ByteCount(), TInteger::WordCount(). |
|
28 |
|
29 The following code demostrates how to create an \c RInteger from a bitstring |
|
30 representation of a big integer. |
|
31 |
|
32 @code |
|
33 //This creates an RInteger from the following binary hexadecimal (base 16) |
|
34 //descriptor. Note that the number is written overall in big endian (most |
|
35 //significant digit is first, least significant digit (ones digit) is last). |
|
36 //P.S. The hexadecimal binary descriptor below is the base 16 representation |
|
37 //of the base 10 number 123456789012345678901234567890. |
|
38 RInteger integer = RInteger::NewL(_L8("18EE90FF6C373E0EE4E3F0AD2")); |
|
39 CleanupStack::PushL(integer); |
|
40 |
|
41 //This next line converts the number stored by an RInteger into a binary, big |
|
42 //endian, hexadecimal descriptor. |
|
43 HBufC8* descriptor = integer.BufferLC(); |
|
44 CleanupStack::Pop(descriptor); |
|
45 CleanupStack::PopAndDestroy(integer); |
|
46 //descriptor is the same as the original _L8 input value now. |
|
47 @endcode |
|
48 |
|
49 For more information on integers, including important memory management |
|
50 information and additional creation overloads, see \c RInteger @ref RInteger. |
|
51 |
|
52 */ |
|
53 |