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
- Committer:
- andrewboyson
- Date:
- 2019-09-24
- Revision:
- 60:b4f337685ec4
- Child:
- 61:d4fc276a824e
File content as of revision 60:b4f337685ec4:
#include <stdint.h>
#include <stdbool.h>
//Assembly instructions
extern void BnZer2048(uint32_t* acc);
extern void BnInc2048(uint32_t* acc);
extern bool BnShr2048(uint32_t* acc, bool bitIn); //Returns bit shifted out
extern bool BnShl2048(uint32_t* acc, bool bitIn); //Returns bit shifted out
extern void BnCpy2048(uint32_t* acc, uint32_t* value);
extern void BnOrr2048(uint32_t* acc, uint32_t* value);
extern void BnAdd2048(uint32_t* acc, uint32_t* value);
extern void BnSub2048(uint32_t* acc, uint32_t* value);
extern bool BnIse2048( uint32_t* value);
extern bool BnIne2048( uint32_t* value);
extern int BnCmp2048(uint32_t* lhs, uint32_t* rhs);
extern void BnZer1024(uint32_t* acc);
extern void BnInc1024(uint32_t* acc);
extern bool BnShr1024(uint32_t* acc, bool bitIn); //Returns bit shifted out
extern bool BnShl1024(uint32_t* acc, bool bitIn); //Returns bit shifted out
extern void BnCpy1024(uint32_t* acc, uint32_t* value);
extern void BnOrr1024(uint32_t* acc, uint32_t* value);
extern void BnAdd1024(uint32_t* acc, uint32_t* value);
extern void BnSub1024(uint32_t* acc, uint32_t* value);
extern bool BnIse1024( uint32_t* value);
extern bool BnIne1024( uint32_t* value);
extern int BnCmp1024(uint32_t* lhs, uint32_t* rhs);
// Text functions
extern void BnParseHex2048(uint32_t* n, const char* p);
extern void BnAsHttp2048 (uint32_t* n);
extern void BnParseHex1024(uint32_t* n, const char* p);
extern void BnAsHttp1024 (uint32_t* n);
// Arithmetic operations
extern void Bn1024Mul2048(uint32_t* a1024, uint32_t* b1024, uint32_t* r2048);
extern void BnRem1024(int numSize, uint32_t* n, uint32_t* d1024, uint32_t* r1024);
//Asynchronous operations
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);
extern bool BnModExpIterate1024(uint32_t m[32], uint32_t e[32], uint32_t n[32], uint32_t r[32]); //Returns true if finished