|
|
|
@ -30,9 +30,10 @@ void main(void) { |
|
|
|
|
|
|
|
|
|
|
|
/* Initialize variables */ |
|
|
|
/* Initialize variables */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// P has to be a prime number!
|
|
|
|
t_encryptionArithmetic P; |
|
|
|
t_encryptionArithmetic P; |
|
|
|
encryptionArithmetic_Init(&P, KEY_LENGTH); |
|
|
|
encryptionArithmetic_Init(&P, KEY_LENGTH); |
|
|
|
if (encryptionArithmetic_stringToHex("19", P.number, KEY_LENGTH) == false) { |
|
|
|
if (encryptionArithmetic_stringToHex("99497", P.number, KEY_LENGTH) == false) { |
|
|
|
printf("ERROR: Creating P."); |
|
|
|
printf("ERROR: Creating P."); |
|
|
|
return 1000000; |
|
|
|
return 1000000; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -46,14 +47,14 @@ void main(void) { |
|
|
|
|
|
|
|
|
|
|
|
t_encryptionArithmetic pub; |
|
|
|
t_encryptionArithmetic pub; |
|
|
|
encryptionArithmetic_Init(&pub, KEY_LENGTH); |
|
|
|
encryptionArithmetic_Init(&pub, KEY_LENGTH); |
|
|
|
if (encryptionArithmetic_stringToHex("11", pub.number, KEY_LENGTH) == false) { |
|
|
|
if (encryptionArithmetic_stringToHex("1100", pub.number, KEY_LENGTH) == false) { |
|
|
|
printf("ERROR: Creating pub."); |
|
|
|
printf("ERROR: Creating pub."); |
|
|
|
return 1000002; |
|
|
|
return 1000002; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
t_encryptionArithmetic priv; |
|
|
|
t_encryptionArithmetic priv; |
|
|
|
encryptionArithmetic_Init(&priv, KEY_LENGTH); |
|
|
|
encryptionArithmetic_Init(&priv, KEY_LENGTH); |
|
|
|
if (encryptionArithmetic_stringToHex("21", priv.number, KEY_LENGTH) == false) { |
|
|
|
if (encryptionArithmetic_stringToHex("2100", priv.number, KEY_LENGTH) == false) { |
|
|
|
printf("ERROR: Creating priv."); |
|
|
|
printf("ERROR: Creating priv."); |
|
|
|
return 1000003; |
|
|
|
return 1000003; |
|
|
|
} |
|
|
|
} |
|
|
|
|