Thread: Help with Numbers - Newbie Problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    10

    Question Help with Numbers - Newbie Problem

    Hiya,

    I have been trying to learn C, and so far thanks to this site I have made progress. Now I want to do this, but I have been on it for hours and I have googled it and so forth but I dont know where to go.

    What I am trying to do here is I have the values that I want, but I want to work it out in C. I would be ever so grateful if you could guide me.

    Code:
    #include<stdio.h>
    #include<limits.h>
    
    int main(void)
    {
        unsigned long long c,n,d,t;
        c = 1340663;
        d = 1073;
        n = 2059;
    
        // t = c^d mod n
    	t = c*d%n;
        printf("%d", t);
        printf("\n t should be 31087, if not, its wrong");
    
    return(0);
    }
    Code:
    /*
    p = 29
    q = 71
    n = 2059
    e = 137
    d = 1073
    text = yo
    converted to numbers = 31093
    encrypted the numbers = 1340663
    */
    Thanks for your help in advance.
    Last edited by Sn1per; 10-30-2009 at 01:18 PM. Reason: brought in new values

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with adding up numbers from a txt file
    By Leo12 in forum C Programming
    Replies: 1
    Last Post: 02-18-2009, 01:50 PM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. Problem with random numbers
    By yaya in forum C++ Programming
    Replies: 6
    Last Post: 05-30-2007, 10:30 AM
  4. Newbie question: Problem with malloc
    By Ikim in forum C Programming
    Replies: 2
    Last Post: 02-05-2006, 10:11 PM
  5. Random Numbers...Problem With FAQ Answer
    By sitestem in forum C++ Programming
    Replies: 12
    Last Post: 04-14-2004, 09:22 AM