⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 椭圆曲线密码C实现的
💻 CPP
字号:
// vlong.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include "conio.h"
#include "vlong.h"
#include "test.h"

void foo(double a)
{
	int x = a;
}

struct C {
    operator double() const
	{
		return 111.1;
	}
	
    operator int () const
	{
		return 111;
	}

    operator long ()
	{
		return 222;
	}
};

static int is_probable_prime( const vlong &p )
{
  // Test based on Fermats theorem a**(p-1) = 1 mod p for prime p
  // For 1000 bit numbers this can take quite a while
	const rep = 4;
	const unsigned any[rep] = { 2,3,5,7 };
	vlong tp;
	tp = 10;
	for ( unsigned i=0; i<rep; i+=1 )
	{	
		if ( modexp( any[i], p-1, p ) != vlong(1) )
			return 0;
		
	}

  return 1;
}

int main(int argc, char* argv[])
{
	vlong  r,x,y;
	x = 0;
	y = 1;
	
	r = x / y;
	int op = r;
    C aC;
    const C acC;
////////////////////////////////////////////////////////
//	foo();
	aC.operator int();
	aC.operator double();
	aC.operator long();
//////////////////////////////////////////////////////////
	acC.operator int();
	acC.operator double();
//	acC.operator long();
////////////////////////////////////////////////////////////
	foo(acC);  // calls "operator int() const"
    foo(aC);   // calls "operator int() const" in VC2.0, 
               // but "operator long()" in VC4.0

/*
	CTest xx;
	xx = 1000;
	xx = 10;
*/	
	vlong p;
	is_probable_prime(p);

/*	
	int i;
	i = test(2,3);
	vlong_value	x,y,t;
	x.reserve(4);
	y.reserve(4);
	t.reserve(10);

	x.set(0,2222);
//	x.set(1,0x11111111);
	y.set(0,332332);
//	y.set(1,0x11111111);
	t.fast_mul(x,y,256);
	i = t.bits();
	y.shr(3);

	for(i = y.n-1 ; i >= 0 ; i--)
	{
		unsigned x = y.get(i);
		printf("%d ",x);
	}
*/

	getch();
	return 0;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -