Click here to Skip to main content
15,897,291 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
Questionusing a .net control from native code Pin
Dave Calkins5-Sep-06 16:31
Dave Calkins5-Sep-06 16:31 
AnswerRe: using a .net control from native code Pin
Nish Nishant6-Sep-06 10:32
sitebuilderNish Nishant6-Sep-06 10:32 
GeneralRe: using a .net control from native code Pin
Dave Calkins6-Sep-06 10:41
Dave Calkins6-Sep-06 10:41 
GeneralRe: using a .net control from native code Pin
Nish Nishant6-Sep-06 10:46
sitebuilderNish Nishant6-Sep-06 10:46 
GeneralRe: using a .net control from native code Pin
Dave Calkins6-Sep-06 11:02
Dave Calkins6-Sep-06 11:02 
GeneralRe: using a .net control from native code Pin
led mike6-Sep-06 11:52
led mike6-Sep-06 11:52 
QuestionPanning sound Pin
lman8175-Sep-06 11:43
lman8175-Sep-06 11:43 
QuestionCrypto Formula Malfunction Pin
rawstar5-Sep-06 6:29
rawstar5-Sep-06 6:29 
Hi, probably not the best place for this but maybe someone can help.
For one of my programs i'm trying to impliment my own version of the RSA algorithm, the encryption works fine, however the decrption does not, even though it uses basically the same algorithm. The code is as follows:

<br />
<br />
//		g++ main.c -o main<br />
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include "math.h"<br />
<br />
<br />
int do_crypto(int M, int e, int N);<br />
<br />
int main()<br />
{<br />
	<br />
	printf("...\n");<br />
	<br />
	//	TWO PRIMES FOR OUR KEY<br />
	int p = 17;<br />
	int q = 11;<br />
	//	THIRD PART OF OUR KEY (PUBLIC)<br />
	int e = 7;<br />
	//	CALCULATE THE OTHER PART OF THE PUBLIC KEY<br />
	int N = p * q;	//	= 187<br />
	<br />
	//	THE CHARACTER TO ENCODE AS ASCII<br />
	int M = 88;<br />
	//int M = "M";<br />
	<br />
	//	ENCRYPT A CHARACTER<br />
	//int C = int ( M * exp(e) ) % N;<br />
	int C = do_crypto(M, e, N);		//	int M, int e, int N)<br />
	printf("C = %d \n", C);<br />
	<br />
	<br />
	//	CALCULATE THE DECRYPT KEY<br />
	//int d = ( 1 % ( (p-1) * (q-1) ) ) / e;<br />
	int d =  ( ( (p-1) * (q-1) ) / e );<br />
	printf("d = %d \n", d);<br />
	<br />
	<br />
	// DECRYPT THE CHARACTER<br />
	int m = do_crypto(11, 23, 187);		//	int C, int d, int N)<br />
	printf("m = %d \n", m);<br />
	<br />
	<br />
	return 0;<br />
}<br />
<br />
int do_crypto(int M, int e, int N)<br />
{<br />
	int iret = int ( M * exp(e) ) % N;<br />
	<br />
	return iret;<br />
}<br />
<br />


When decrypting I have put in actual values for the keys etc, and the result should be 88.
The actual formulas are:
ENCRYPT: C = Me (Mod N)
DECRYPT: M = Cd (Mod N)
*** Please note the 'e' and 'd' are supposed to be superscript, e.g. raised to the power of...
AnswerRe: Crypto Formula Malfunction Pin
led mike5-Sep-06 6:44
led mike5-Sep-06 6:44 
QuestionMake executable file Pin
jucanpo5-Sep-06 6:08
jucanpo5-Sep-06 6:08 
AnswerRe: Make executable file Pin
toxcct5-Sep-06 6:16
toxcct5-Sep-06 6:16 
GeneralRe: Make executable file Pin
jucanpo5-Sep-06 6:23
jucanpo5-Sep-06 6:23 
GeneralRe: Make executable file Pin
toxcct5-Sep-06 21:31
toxcct5-Sep-06 21:31 
AnswerRe: Make executable file Pin
led mike5-Sep-06 6:28
led mike5-Sep-06 6:28 
QuestionGDI+ DrawPie problem? Bugs? Pin
moonreflection20005-Sep-06 5:23
moonreflection20005-Sep-06 5:23 
AnswerRe: GDI+ DrawPie problem? Bugs? Pin
Jun Du5-Sep-06 13:55
Jun Du5-Sep-06 13:55 
GeneralRe: GDI+ DrawPie problem? Bugs? Pin
moonreflection20006-Sep-06 10:17
moonreflection20006-Sep-06 10:17 
GeneralRe: GDI+ DrawPie problem? Bugs? Pin
Jun Du6-Sep-06 10:39
Jun Du6-Sep-06 10:39 
Questioncalling managed code from unmanaged code (vc6) Pin
Dragan Matic5-Sep-06 1:24
Dragan Matic5-Sep-06 1:24 
AnswerRe: calling managed code from unmanaged code (vc6) Pin
led mike5-Sep-06 9:50
led mike5-Sep-06 9:50 
GeneralRe: calling managed code from unmanaged code (vc6) Pin
Dragan Matic5-Sep-06 21:56
Dragan Matic5-Sep-06 21:56 
GeneralRe: calling managed code from unmanaged code (vc6) Pin
led mike6-Sep-06 5:16
led mike6-Sep-06 5:16 
QuestionIcon information?? Pin
Sgg2453-Sep-06 19:12
Sgg2453-Sep-06 19:12 
AnswerRe: Icon information?? [modified] Pin
WillemM4-Sep-06 5:29
WillemM4-Sep-06 5:29 
Questionwhat is the implementation? Pin
robeelyn2-Sep-06 5:02
robeelyn2-Sep-06 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.