1 /**************************************************************************/
5 modified: microBuilder.eu
9 Basic RSA-encryption using 64-bit math (32-bit keys).
11 Based on the examples from "Mastering Algorithms with C" by
12 Kyle Loudon (O'Reilly, 1999).
14 /**************************************************************************/
19 #include "projectconfig.h"
21 /* In a secure implementation, huge_t should be at least 400 decimal digits, *
22 * instead of the 20 provided by a 64-bit value. This means that key values *
23 * can be no longer than 10 digits in length in the current implementation. */
24 #if CFG_RSA_BITS == 64
25 typedef uint64_t huge_t
;
27 #if CFG_RSA_BITS == 32
28 typedef uint32_t huge_t
;
31 /* Structure for RSA public keys. */
32 typedef struct rsaPubKey_s
39 /* Define a structure for RSA private keys. */
40 typedef struct rsaPriKey_s
48 void rsaEncrypt(huge_t plaintext
, huge_t
*ciphertext
, rsaPubKey_t pubkey
);
49 void rsaDecrypt(huge_t ciphertext
, huge_t
*plaintext
, rsaPriKey_t prikey
);
This page took 0.045691 seconds and 5 git commands to generate.