Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: test-lpc1768 oldheating gps motorhome ... more
bignum/bignum.h@60:b4f337685ec4, 2019-09-24 (annotated)
- Committer:
- andrewboyson
- Date:
- Tue Sep 24 18:15:09 2019 +0000
- Revision:
- 60:b4f337685ec4
- Child:
- 61:d4fc276a824e
Added big numbers
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| andrewboyson | 60:b4f337685ec4 | 1 | #include <stdint.h> |
| andrewboyson | 60:b4f337685ec4 | 2 | #include <stdbool.h> |
| andrewboyson | 60:b4f337685ec4 | 3 | |
| andrewboyson | 60:b4f337685ec4 | 4 | //Assembly instructions |
| andrewboyson | 60:b4f337685ec4 | 5 | extern void BnZer2048(uint32_t* acc); |
| andrewboyson | 60:b4f337685ec4 | 6 | extern void BnInc2048(uint32_t* acc); |
| andrewboyson | 60:b4f337685ec4 | 7 | extern bool BnShr2048(uint32_t* acc, bool bitIn); //Returns bit shifted out |
| andrewboyson | 60:b4f337685ec4 | 8 | extern bool BnShl2048(uint32_t* acc, bool bitIn); //Returns bit shifted out |
| andrewboyson | 60:b4f337685ec4 | 9 | extern void BnCpy2048(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 10 | extern void BnOrr2048(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 11 | extern void BnAdd2048(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 12 | extern void BnSub2048(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 13 | extern bool BnIse2048( uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 14 | extern bool BnIne2048( uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 15 | extern int BnCmp2048(uint32_t* lhs, uint32_t* rhs); |
| andrewboyson | 60:b4f337685ec4 | 16 | |
| andrewboyson | 60:b4f337685ec4 | 17 | extern void BnZer1024(uint32_t* acc); |
| andrewboyson | 60:b4f337685ec4 | 18 | extern void BnInc1024(uint32_t* acc); |
| andrewboyson | 60:b4f337685ec4 | 19 | extern bool BnShr1024(uint32_t* acc, bool bitIn); //Returns bit shifted out |
| andrewboyson | 60:b4f337685ec4 | 20 | extern bool BnShl1024(uint32_t* acc, bool bitIn); //Returns bit shifted out |
| andrewboyson | 60:b4f337685ec4 | 21 | extern void BnCpy1024(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 22 | extern void BnOrr1024(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 23 | extern void BnAdd1024(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 24 | extern void BnSub1024(uint32_t* acc, uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 25 | extern bool BnIse1024( uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 26 | extern bool BnIne1024( uint32_t* value); |
| andrewboyson | 60:b4f337685ec4 | 27 | extern int BnCmp1024(uint32_t* lhs, uint32_t* rhs); |
| andrewboyson | 60:b4f337685ec4 | 28 | |
| andrewboyson | 60:b4f337685ec4 | 29 | // Text functions |
| andrewboyson | 60:b4f337685ec4 | 30 | extern void BnParseHex2048(uint32_t* n, const char* p); |
| andrewboyson | 60:b4f337685ec4 | 31 | extern void BnAsHttp2048 (uint32_t* n); |
| andrewboyson | 60:b4f337685ec4 | 32 | extern void BnParseHex1024(uint32_t* n, const char* p); |
| andrewboyson | 60:b4f337685ec4 | 33 | extern void BnAsHttp1024 (uint32_t* n); |
| andrewboyson | 60:b4f337685ec4 | 34 | |
| andrewboyson | 60:b4f337685ec4 | 35 | // Arithmetic operations |
| andrewboyson | 60:b4f337685ec4 | 36 | extern void Bn1024Mul2048(uint32_t* a1024, uint32_t* b1024, uint32_t* r2048); |
| andrewboyson | 60:b4f337685ec4 | 37 | extern void BnRem1024(int numSize, uint32_t* n, uint32_t* d1024, uint32_t* r1024); |
| andrewboyson | 60:b4f337685ec4 | 38 | |
| andrewboyson | 60:b4f337685ec4 | 39 | //Asynchronous operations |
| andrewboyson | 60:b4f337685ec4 | 40 | extern void BnModExpStart1024 (uint32_t m[32], uint32_t e[32], uint32_t n[32], uint32_t r[32], uint32_t* message, uint32_t* exponent, uint32_t* modulus); |
| andrewboyson | 60:b4f337685ec4 | 41 | extern bool BnModExpIterate1024(uint32_t m[32], uint32_t e[32], uint32_t n[32], uint32_t r[32]); //Returns true if finished |
| andrewboyson | 60:b4f337685ec4 | 42 |