C :: Point Operations On Elliptic Curve In A Prime Field
Apr 21, 2013
I am trying to write a program to perform point operations on a elliptic curve in a prime field I am using the standard formulaes for point additions and doubling in my code and these operations are performed by functions that are called but I am getting output for certain points but not all.
Code:
structure point_multiply(int x, int y, int k ) {
int xk;
int yk,m;
xk=x;
yk=y;
m=1;
int xL,yL,s,e;
[code].....
s1, s2, s3 etc are structures which hold a 2 integers which act as x and y co-ordinates.I am getting output by entering k=3,g=4, h=5 and many other cases mostly with small numbers but not for larger numbers.
If i do run the above program in turbo C/C++ complier, it outputs "h". But,if i change the code as i=0.6 and if (i<0.6), it outputs "w". Even if i change it to i=0.8 and if(i<0.8), then also it outputs "w".
class DataBase { // Change the connection path here to your own version of the database public SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=|DataDirectory|UberDatabase.mdf;Integrated Security=True;"); public DataBase() { } }
And in the same namespace as this class I have a form that calls it like so:
DataBase dBase = new DataBase(); SqlCommand trythis = new SqlCommand("Register", dBase.con);
However, I'm getting the field initializer error on dBase.con. I'm not sure why, but when I call the database from another file (program.cs) it works fine this way.
I need to know how can i extract control points from a specific character. (this case is it possible?). So, more specifically, i have a specific character, let 'a' this character. So what i need, is how to extract control points from this character in order to draw it as a bezier curve.
I'm a new coder for C++, and I've recently learned java before starting this programming language. I'm attempting to find all prime numbers up to the number a user enters (i.e. User enters 10, System shows "1,2,3,5,7"),
#include <iostream> #include <cstdlib> using namespace std; int main(int argc, char** argv) { int num; cout << "Enter a positive number." << endl;
[Code] ....
I've been looking at my forloop, and I can't seem to pinpoint the problem with it.
I have one code that use MPI broadcast and I want to change it into Asynchronous Point to Point communication. I am newbie in Parallel programming. Looking for implementation of one simple same program in broadcast and P2P ?
I wrote a program which sends a starting and ending range to other processes and the processes calculate the prime numbers in that range and return the count of prime numbers to the head process, process 0. But this is not working properly at the moment. I realize I still have to split up the range based on how many processes I have...I still have not figured out how I want to set that up. I
Code:
#include <stdio.h> #include <stdlib.h> #include <mpi.h> int isPrime(int num); int main(int argc, char **argv){ }
So I think I am having syntactical problem with my code.
Code: int main() { vector<int> ivec; int score; [Code] ....
I get an error from my compiler on the ?10th? line (Nested condition line) that says |19|error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'|
The purpose of the program is to take input and store it in a vector and then change the value to be between 1-6. I made this for the purpose of learning about nested conditional operations.
Trying to write 4 bytes ints in a binary file and extract them after... I'm using the exclusive or (^) to isolate single bytes to write to and extract from the file since the write() function accepts only chars, only the beginning and end results are not the same...
I've been thinking over this for long time... For example, when a button is clicked, print a string "clicked" after 5 seconds. (the button won't be blocked)
when I input the character which is the underscore, and the row # it should display the table and sort that specific row. Why is the if statement skipped? This is not the complete program but has everything needed.
I've sometimes encountered unexpected runtime issues caused by unsigned values being decremented below zero.
Example 1: "unsigned_value += negative_integer_value;" Example 2: "for( size_t i = size - 1; i >= 0; --i )"
My compiler doesn't provide any compile-time or run-time warnings.
As far as I know, it's not possible to overload operators of primitive data types to check if the unsigned value is decremented below zero.
Any clever strategy to trace such cases at debug runtime, without having to add asserts all over the code? It's important that it does not affect performance in release mode.
I'm working on a class project, and I'm having a difficulty. Suppose I have: string a = "21" and string b = "30"; normally, a+b=2130 (i.e concatenation of the characters in the string) but suppose I want a+b=51 (i.e. numerical addition) how do I go about this?
I'm doing a bitwise operations on 2 bytes in a buffer, then storing the result in a variable. However, I sometimes get a non-zero value for the variable even though I'm expecting a zero value.
The relevant portion of the code is as follows.
unsigned int result = 0; long j = 0, length; unsigned char *data; data = (unsigned char *)malloc(sizeof(unsigned char)*800000);
[Code] ......
I'm expecting result to be zero when my data[j] and data[j+1] are 0xb6 and 0xab respectively, which is the case for most of the time. However, for certain values of j, my result is strangely not zero.
j = 62910, result = 64 j = 78670, result = 64 j = 100594, result = 64 j = 165658, result = 512 j = 247990, result = 128 j = 268330, result = 512 j = 326754, result = 1 j = 415874, result = 256 j = 456654, result = 1024 j = 477366, result = 512
It appears that these strange result values are all powers of 2, with a 1 bit appearing somewhere in the unsigned int.
I'm not changing the value of result anywhere else in the code, and when I print out (unsigned int)(((data[j]^0xb6)<<8)|(data[j+1]^0xab)), I get 0, but somehow when it gets stored in result, it's no longer zero.
Why the placement of the code on line 21 above matters.
It grabs the correct string just fine. If I write a printf just below it, it prints the string it should correctly. However, if I do a printf of the string OSUteamCode below the fopen call on line 23, it prints blank.
So the first thing I did was move it below the fopen line. It worked, finding and outputting the first game in "game.csv" just fine, but not the other 11. Debugging with printf shows that the contents of OSUteamCode again disappear after the fopen call in the addLineCSV function.
I'm not understanding why that happens. The only thing I can figure is there's something going on with the file I/O commands that I just don't understand, but I can't find anything online that explains what that might be.
I just started learning C++ a week ago and have been stuck on a project for the past 2 days now. I am building a limited purpose calculator which finds the value of one of five operations. Visual studio doesn't underline any errors in my program but every time I try to run it I get an error message. I believe it has something to do with the if/else but Im not sure.
#include <iostream> using namespace std; int main(){ int a; int b; int sum = a + b;
I've been assigned to build a program which completes mathematical operations using matrices. I have to use dynamically allocated 2d arrays, and can only use * to dereference and not []. I have this code so far, but the multiply_matrix function does not work with most values. I've looked at other similar posts, which have a similar algorithm to mine, but mine does not work for some reason.
/* *(*matrix(matrix+i)+j) */
#include <iostream> //for sleep() which allows user to see messages before screen is cleared #include <unistd.h> using namespace std;
how to use template parameters to perform arithmetic operations on objects.
I feel that it would best to demonstrate my issue rather than try and explain it.
Sample:
// Fundamental object structure template<int T> struct myInt { myInt() { value = T; };
[Code]....
What I don't know is how to get a hold of the T variable to add them through the 'add' structure. Also, might any of this have to do with sequence wrappers?
seq_c<T,c1,c2,... cn> is essentially what I'm thinking of. Where T in this case is the type and c to the nth c are the values.
I'm trying to write a simple program that extract the FAT information from a FAT32 virtual Hard Disk.I have the following structures regarding the FAT format:
Code:
//BOOT RECORD typedef struct NF_BOOT_RECORD { unsigned char BS_jumpBoot[3]; //EB 58 90 = JUMP 58 NOP (Jumps to boot code). Also E9 is acceptable. unsigned char BS_OEMName[8]; //Either MSWIN4.1 or mkdosfs unsigned short BS_BytesPerSec; //Little endian. The size of a sector. 128,256,512,1024... unsigned char BS_SecPerClus; //The number of sectors per cluster (1 CLUSTER = BPS*SPC BYTES) unsigned short BS_RsvdSecCnt; //The boot sectors (this) are included. That makes at least 1. }
[code]...
Everything seems to work fine. Mostly. The only problem, is that the program gives me the following output:BS_NumFATs shouldn't be 0. In fact, I've checked inside the structure memory, and the information seems correct. BS_NumFATs is 0x02, not 0x00 (It's the byte at offset 0x10, starting at 0x00).
I've checked the order of the structure fields, and their types, comparing them to the FAT specification given by Microsoft (File fatgen103.pdf), and it seems fine, unless I'm missing something. So I don't know why it gives 0 instead of 2, if I'm missing something.It's a Win32 program compiled with GCC version 4.4.0
I wrote a script that generates n random pixel positions and draws them to the screen. Works well. Now i tried to rotate them. Rotating does work too. But it does not work as i planned it.
paramters 'angle' and 'timestep' work somehow, but not as they should do. the function 'move' is supposed to rotate the pixelfield 'angle' degrees in a given direction, addicted to the 'timestep' parameter. 'timestep' is needed time for drawing in one single game loop.
rotation point is the middle of the screen. when i set angle to 10 it should rotate 10 degrees / second. Instead it's rotating very very fast and all stars are moving nearer to the center of the screen, so after x rounds there is just 1 pixel left in the middle of the screen. there is a kind of gravition.I'm working with SDL2. What I did find out:
FPS is <= 60, 'cause of the 'SDL_RENDERER_PRESENTVSYNC' flag. When i skip that flag, for any reason the 'gravition' would take more time. FPS is <= 1400 then, 'though i got a natural game loop (i hope):
I need writing a program in c++ that will get the input of 50 different users for the following the fields (surname, other names, sex, status, date of birth) and after entering the data for these 50 users, it will then output only the list of all FEMALE users who were registered...
#include <iostream> #include <string> using namespace std; int main () { string surname, other_names1, other_names2, status, sex, dob;
[Code] ....
I don't really know what to do next - all my attempts have not really given me the result I want.